effective_resources 1.12.1 → 1.12.4
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 +4 -4
- data/app/controllers/concerns/effective/wizard_controller/actions.rb +4 -1
- data/app/controllers/concerns/effective/wizard_controller/save.rb +6 -1
- data/app/models/concerns/acts_as_purchasable_wizard.rb +1 -1
- data/app/models/concerns/acts_as_wizard.rb +4 -0
- data/app/models/effective/resources/relation.rb +1 -3
- data/lib/effective_resources/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78a62dc6fc911b14bbf9972a75a5a4efcb8c1be89f049c67698a8eef4d3c4c65
|
4
|
+
data.tar.gz: 236d6cd2e737b360d0678ca861804f7a07f841b88bf6180befef3f55e2a5194d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f3030caa00296cc2aa2af8c33eeaf77ad6a7b3a08bd601a563c422e605f75f0d8ce8070f5c389c2267aca25d62fba94f391404ca8d6b2de9ce8182f0ce005cb
|
7
|
+
data.tar.gz: 0ceda0d79b3f8a0c9783c997c3ca40b05e00e046f4f22917560bf983b021a4b963fe7d8fc37ffcd8e996e671bdc67a9b31d0390a2fa6b074f221a7c3a17d500d
|
@@ -24,10 +24,13 @@ module Effective
|
|
24
24
|
def update
|
25
25
|
Rails.logger.info 'Processed by Effective::WizardController#update'
|
26
26
|
|
27
|
+
action = (commit_action[:action] == :save ? :update : commit_action[:action])
|
28
|
+
EffectiveResources.authorize!(self, action, resource)
|
29
|
+
|
27
30
|
resource.assign_attributes(send(resource_params_method_name))
|
28
31
|
assign_current_step
|
29
32
|
|
30
|
-
save_wizard_resource(resource)
|
33
|
+
save_wizard_resource(resource, action)
|
31
34
|
end
|
32
35
|
|
33
36
|
end
|
@@ -4,12 +4,17 @@ module Effective
|
|
4
4
|
|
5
5
|
def save_wizard_resource(resource, action = nil, options = {})
|
6
6
|
was_new_record = resource.new_record?
|
7
|
-
|
7
|
+
|
8
|
+
if action.blank? || action == :update
|
9
|
+
action = resource.respond_to?("#{step}!") ? step : :save
|
10
|
+
end
|
8
11
|
|
9
12
|
if save_resource(resource, action)
|
10
13
|
flash[:success] ||= options.delete(:success) || resource_flash(:success, resource, action)
|
11
14
|
|
12
15
|
@skip_to ||= skip_to_step(resource)
|
16
|
+
|
17
|
+
@redirect_to ||= resource_redirect_path(resource, action) if specific_redirect_path?(action)
|
13
18
|
@redirect_to ||= resource_wizard_path(resource, @skip_to) if was_new_record
|
14
19
|
|
15
20
|
if @redirect_to
|
@@ -62,7 +62,7 @@ module ActsAsPurchasableWizard
|
|
62
62
|
end
|
63
63
|
|
64
64
|
# From Billing Step
|
65
|
-
order.billing_address = owner.billing_address if owner.billing_address.present?
|
65
|
+
order.billing_address = owner.billing_address if owner.try(:billing_address).present?
|
66
66
|
|
67
67
|
# Important to add/remove anything
|
68
68
|
order.save!
|
@@ -95,8 +95,6 @@ module Effective
|
|
95
95
|
relation.where(is_null("#{sql_column}_id")).where(is_null("#{sql_column}_type"))
|
96
96
|
elsif type.present? && id.present? # This was from a polymorphic select
|
97
97
|
relation.where("#{sql_column}_id = ?", id).where("#{sql_column}_type = ?", type)
|
98
|
-
elsif name == :user # Polymorphic user
|
99
|
-
relation.where(search_by_associated_conditions(association, term, fuzzy: fuzzy))
|
100
98
|
else # Maybe from a string field
|
101
99
|
collection = relation.none
|
102
100
|
|
@@ -106,7 +104,7 @@ module Effective
|
|
106
104
|
resource = Effective::Resource.new(klass_name)
|
107
105
|
next unless resource.klass.present?
|
108
106
|
|
109
|
-
collection = collection.or(relation.where("#{name}_id": resource.search_any(term), "#{name}_type": klass_name))
|
107
|
+
collection = collection.or(relation.where("#{name}_id": resource.search_any(term, fuzzy: fuzzy), "#{name}_type": klass_name))
|
110
108
|
end
|
111
109
|
|
112
110
|
collection
|
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.12.
|
4
|
+
version: 1.12.4
|
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-
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|