effective_orders 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1a47576086e85e24dc44de2c8c6e2c6bc78e074
4
- data.tar.gz: 2eda2b07e901a0a0af711768a2d0e6210fac5791
3
+ metadata.gz: c1cf9baa9d485752d3758cd486c22451656851a9
4
+ data.tar.gz: c4e7fae35b93f72319b7b525382c085272c8f016
5
5
  SHA512:
6
- metadata.gz: 4597fbb04b3808a5de5cd7e6f3e6034c5b1405491b1705dfd96cedf9d3dbedd8909d3ce8ba2f11b6fd6f3ffa262dc8e70a6a71f6284622bd85e3a7db4f815e43
7
- data.tar.gz: f8e2772c836c2becb559ba5a4659a23311dc156d48f0d7730e94687c26488f94b99c8f28626323073b465d6d115a073f317584e507fe728634613122b080b679
6
+ metadata.gz: 406fb85de09e76af4dcbd5c3ef92d911f587a8bbdce2cefeb5f095ccf2f1e1341e2e7b716a21b4106c06baff89a5285281fcd407b4e381512acaa9c3ff2add5c
7
+ data.tar.gz: dbff00b400518808d5071d166c8246a673fda871a71304e5ad16726e7402c355e77389a4965bc363b4cbc81715261c1efd9dc1cb6ea1887a1dbe50071f9e6d8b
@@ -2,17 +2,17 @@ module ActsAsActiveAdminController
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  module ActionController
5
- def acts_as_active_admin_controller(key)
6
- @active_admin_resource_element_lookup_key = key
5
+ def acts_as_active_admin_controller(element_lookup_key)
6
+ @active_admin_resource_element_lookup_key = element_lookup_key
7
7
  include ::ActsAsActiveAdminController
8
8
  end
9
9
  end
10
10
 
11
11
  included do
12
- include ::ActiveAdmin::BaseController::Menu
13
- include ::ActiveAdmin::BaseController::Authorization
12
+ include ActiveAdmin::BaseController::Menu
13
+ include ActiveAdmin::BaseController::Authorization
14
14
 
15
- helper ::ActiveAdmin::ViewHelpers
15
+ helper ActiveAdmin::ViewHelpers
16
16
  helper_method :active_admin_config, :active_admin_namespace, :current_active_admin_user
17
17
 
18
18
  resource_key = @active_admin_resource_element_lookup_key.to_s
@@ -36,7 +36,7 @@ module ActsAsActiveAdminController
36
36
  end
37
37
 
38
38
  def active_admin_namespace
39
- ::ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
39
+ ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
40
40
  end
41
41
 
42
42
  def active_admin_config
@@ -45,7 +45,7 @@ module ActsAsActiveAdminController
45
45
 
46
46
  def active_admin_resource_key
47
47
  @active_admin_resource_key ||= begin
48
- namespace = ::ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
48
+ namespace = ActiveAdmin.application.namespaces[EffectiveOrders.active_admin_namespace || :root]
49
49
  namespace.resources.keys.find { |resource| resource.element == active_admin_resource_element_key }
50
50
  end
51
51
  end
@@ -8,7 +8,7 @@ module Effective
8
8
  end
9
9
 
10
10
  def paypal_postback
11
- @order ||= Effective::Order.where(:id => params[:invoice].to_i).first
11
+ @order ||= Effective::Order.where(id: (params[:invoice].to_i rescue 0)).first
12
12
 
13
13
  EffectiveOrders.authorized?(self, :update, @order)
14
14
 
@@ -9,7 +9,7 @@ module Effective
9
9
  end
10
10
 
11
11
  def stripe_charge
12
- @order = Effective::Order.find(stripe_charge_params[:effective_order_id])
12
+ @order ||= Effective::Order.find(stripe_charge_params[:effective_order_id])
13
13
  @stripe_charge = Effective::StripeCharge.new(stripe_charge_params)
14
14
  @stripe_charge.order = @order
15
15
 
@@ -7,10 +7,6 @@ module EffectiveOrders
7
7
  # Include Helpers to base application
8
8
  initializer 'effective_orders.action_controller' do |app|
9
9
  ActiveSupport.on_load :action_controller do
10
- if EffectiveOrders.use_active_admin
11
- ActionController::Base.extend(ActsAsActiveAdminController::ActionController)
12
- end
13
-
14
10
  helper EffectiveOrdersHelper
15
11
  helper EffectiveCartsHelper
16
12
  helper EffectivePaypalHelper if EffectiveOrders.paypal_enabled
@@ -44,12 +40,16 @@ module EffectiveOrders
44
40
  end
45
41
  end
46
42
 
47
- # ActiveAdmin (optional)
48
- # This prepends the load path so someone can override the assets.rb if they want.
43
+ # Use ActiveAdmin (optional)
49
44
  initializer 'effective_orders.active_admin' do
50
45
  if EffectiveOrders.use_active_admin
51
46
  require 'activeadmin'
52
- ::ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"]
47
+
48
+ ActiveSupport.on_load :action_controller do
49
+ ApplicationController.extend(ActsAsActiveAdminController::ActionController)
50
+ end
51
+
52
+ ActiveAdmin.application.load_paths.unshift Dir["#{config.root}/active_admin"]
53
53
  end
54
54
  end
55
55
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '1.5.0'.freeze
2
+ VERSION = '1.5.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-16 00:00:00.000000000 Z
11
+ date: 2015-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails