effective_resources 1.16.0 → 1.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e7d7a9ee482e38794221a01b428e01de652eb23b63c2b926eda018c47ae057c
4
- data.tar.gz: 5a920c11ce61cf201a20b1a7b2fb946846d1f034ad4e9acb91253b6d0a8f6ce5
3
+ metadata.gz: 88760067301847f6d36a2f8550224e019acf06cc9fcc9021a7cf22799e09d560
4
+ data.tar.gz: 8a922371e95e9f9c91e1cd907b858f19316615508a05077ec5025c7c82c4e1c4
5
5
  SHA512:
6
- metadata.gz: 99d01c855370aa34ad51bc3bde24a11d6b57080616312b4ed8e9c066601ec7fb5275117327780a94f9d85ad81e9a9486c49be29dfcb429f4654b3cac64ce67cc
7
- data.tar.gz: 3fcd18e60abdb8f8da2208a92c6547718611ad70f0018c7a43af831173da3ee44cdc1c5a3a6f033c54d6fe97d67c749b8ccfb01f8b52e46893b132b6a6a5aada
6
+ metadata.gz: c19cbb3988ce98384ff670148617f5779337254fcaee5b4c68f354cd0d9a2bc40d15497db83c53d3f5dd9c37a9e13191f40bf3ed435a8607b05963e2678a292b
7
+ data.tar.gz: 96e9c5059d55ff3ad40a10f891fd8765eb9fee9d359d19809b1566a47dca26cbccde1f18e4f182f64740c2738134d6e08d93be7170add23ef917bed1631c7a9e
@@ -126,10 +126,13 @@ module Effective
126
126
  end
127
127
 
128
128
  def resource_layout
129
+ namespace = controller_path.include?('admin/') ? 'admin' : 'application'
130
+
129
131
  if defined?(Tenant)
130
- namespace = controller_path.include?('admin/') ? 'admin' : 'application'
131
- "#{Tenant.current}/#{namespace}"
132
+ return "#{Tenant.current}/#{namespace}"
132
133
  end
134
+
135
+ namespace
133
136
  end
134
137
 
135
138
  def resource_params_method_name
@@ -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]
@@ -64,8 +64,10 @@ module EffectiveResources
64
64
 
65
65
  # Register the flash_messages concern so that it can be called in ActionController
66
66
  initializer 'effective_resources.action_controller' do |app|
67
- ActiveSupport.on_load :action_controller do
68
- include(Effective::FlashMessages)
67
+ app.config.to_prepare do
68
+ ActiveSupport.on_load :action_controller do
69
+ include(Effective::FlashMessages)
70
+ end
69
71
  end
70
72
  end
71
73
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.16.0'.freeze
2
+ VERSION = '1.17.2'.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.16.0
4
+ version: 1.17.2
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-12 00:00:00.000000000 Z
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails