effective_resources 1.15.1 → 1.17.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
  SHA256:
3
- metadata.gz: 37818a2db37ab767ea5c415519b0674ba87cc5a998978730a7851df8fddeae1d
4
- data.tar.gz: 89f53d6a3238db076a5c9b212ce306109954c1cea374f763b755b7b8ee565e5b
3
+ metadata.gz: fd950c2764b8af440fa475f4a99666009f28ea5c25f352d85d957ee2bf6ea5a3
4
+ data.tar.gz: 5fddb4399b3f8e7c8edb26c317dd561add0573bd1ba3dd7489c7f7fdf408b198
5
5
  SHA512:
6
- metadata.gz: ceb3fdb52931639ebb8ba24454dd103daa45dccc674d2d1dadb1a31d1e89da7f28f9a107a5db6e8dc38e2c688970366b3d36c9e189c78d7b5cca45555468e577
7
- data.tar.gz: 1cea14061c7f0cc2bda9f56efd57f9be8b6018af50cdc72e8759d4ae80a120e5fcfceefea4da0908f95d3fc4161c4bf87d5472c69c93099ebd10137a5d5cb7b7
6
+ metadata.gz: 88867e25b814d72729e9746d12e6d5719a326f55f4097f593b3f2c888eddee003052bf1bea46d7a14e2c4e41cbd7128ec70155030341a2e6227d3a93bd69a647
7
+ data.tar.gz: d8086166e74b60cd6efaebc32705cdffb7940bf70686ded3c12a00b1a7e620ea529211e689b144763f0128bd4ab7c88e2aad37be491513449fabbac27e16e071
@@ -48,9 +48,12 @@ module ActsAsPurchasableWizard
48
48
  end
49
49
 
50
50
  def find_or_build_submit_order
51
- order = submit_order || orders.build(user: owner)
51
+ order = submit_order || orders.build(user: owner) # This is polymorphic user, might be an organization
52
52
  fees = submit_fees().reject { |fee| fee.marked_for_destruction? }
53
53
 
54
+ # A membership could go from individual to organization
55
+ order.user = owner
56
+
54
57
  # Adds fees, but does not overwrite any existing price.
55
58
  fees.each do |fee|
56
59
  order.add(fee) unless order.purchasables.include?(fee)
@@ -56,7 +56,23 @@ module ActsAsWizard
56
56
 
57
57
  def required_steps
58
58
  return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
59
- wizard_step_keys()
59
+
60
+ steps = wizard_step_keys()
61
+
62
+ # Give the caller class a mechanism to change these.
63
+ # Used more in effective memberships
64
+ steps = change_wizard_steps(steps)
65
+
66
+ unless steps.kind_of?(Array) && steps.all? { |step| step.kind_of?(Symbol) }
67
+ raise('expected change_wizard_steps to return an Array of steps with no nils')
68
+ end
69
+
70
+ steps
71
+ end
72
+
73
+ # Intended for use by calling class
74
+ def change_wizard_steps(steps)
75
+ steps
60
76
  end
61
77
 
62
78
  # For use in the summary partials. Does not include summary.
@@ -21,7 +21,7 @@ module EffectiveResources
21
21
 
22
22
  # Include acts_as_addressable concern and allow any ActiveRecord object to call it
23
23
  initializer 'effective_resources.active_record' do |app|
24
- ActiveSupport.on_load :active_record do
24
+ app.config.to_prepare do
25
25
  ActiveRecord::Base.extend(ActsAsArchived::Base)
26
26
  ActiveRecord::Base.extend(ActsAsEmailForm::Base)
27
27
  ActiveRecord::Base.extend(ActsAsTokened::Base)
@@ -38,7 +38,7 @@ module EffectiveResources
38
38
  end
39
39
 
40
40
  initializer 'effective_resources.cancancan' do |app|
41
- ActiveSupport.on_load :active_record do
41
+ app.config.to_prepare do
42
42
  if defined?(CanCan::Ability)
43
43
  CanCan::Ability.module_eval do
44
44
  CRUD_ACTIONS = [:index, :new, :create, :edit, :update, :show, :destroy]
@@ -57,17 +57,17 @@ module EffectiveResources
57
57
  # Register the acts_as_archived routes concern
58
58
  # resources :things, concerns: :acts_as_archived
59
59
  initializer 'effective_resources.routes_concern' do |app|
60
- ActionDispatch::Routing::Mapper.include(ActsAsArchived::RoutesConcern)
61
-
62
- # Doesn't seem to work with the on_load in rails 6.0
63
- #ActiveSupport.on_load :action_controller_base do
64
- #end
60
+ app.config.to_prepare do
61
+ ActionDispatch::Routing::Mapper.include(ActsAsArchived::RoutesConcern)
62
+ end
65
63
  end
66
64
 
67
65
  # Register the flash_messages concern so that it can be called in ActionController
68
66
  initializer 'effective_resources.action_controller' do |app|
69
- ActiveSupport.on_load :action_controller do
70
- include(Effective::FlashMessages)
67
+ app.config.to_prepare do
68
+ ActiveSupport.on_load :action_controller do
69
+ include(Effective::FlashMessages)
70
+ end
71
71
  end
72
72
  end
73
73
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.15.1'.freeze
2
+ VERSION = '1.17.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.1
4
+ version: 1.17.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: 2022-03-08 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails