avo 2.33.3.pre.1 → 2.33.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/avo/fields/belongs_to_field.rb +10 -2
- data/lib/avo/version.rb +1 -1
- metadata +3 -4
- data/config/master.key +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc196e3fee2cace52de6c29deaf6cb48be0d0866b09150b92f2c3242a4e86dd5
|
4
|
+
data.tar.gz: 7b01b1d99127feeac10b1abaca6c31b764395545c12ddece4015c2c10f29fc57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4b85f71610df01c584d9356f005184a67bc5a1baa4db74f0e74411427f01d35fd151f9b3c8258fdae85b3f37d4cbaa153ce5a77b769a316fe12e4c3405c896e
|
7
|
+
data.tar.gz: 936f608896664e6848c0ca1d059407285f4b9d09841dd16e6454a651df87ca76126cd7ff04cf4144c57a57215c080f8f7c9aa2b500554594336a361dd3e39dc7
|
data/Gemfile.lock
CHANGED
@@ -199,11 +199,13 @@ module Avo
|
|
199
199
|
def fill_field(model, key, value, params)
|
200
200
|
return model unless model.methods.include? key.to_sym
|
201
201
|
|
202
|
+
valid_model_class = valid_polymorphic_class params["#{polymorphic_as}_type"]
|
203
|
+
|
202
204
|
if polymorphic_as.present?
|
203
|
-
model.send("#{polymorphic_as}_type=",
|
205
|
+
model.send("#{polymorphic_as}_type=", valid_model_class)
|
204
206
|
|
205
207
|
# If the type is blank, reset the id too.
|
206
|
-
if
|
208
|
+
if valid_model_class.blank?
|
207
209
|
model.send("#{polymorphic_as}_id=", nil)
|
208
210
|
else
|
209
211
|
model.send("#{polymorphic_as}_id=", params["#{polymorphic_as}_id"])
|
@@ -215,6 +217,12 @@ module Avo
|
|
215
217
|
model
|
216
218
|
end
|
217
219
|
|
220
|
+
def valid_polymorphic_class(possible_class)
|
221
|
+
types.find do |type|
|
222
|
+
type.to_s == possible_class.to_s
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
218
226
|
def database_id
|
219
227
|
# If the field is a polymorphic value, return the polymorphic_type as key and pre-fill the _id in fill_field.
|
220
228
|
return "#{polymorphic_as}_type" if polymorphic_as.present?
|
data/lib/avo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.33.3
|
4
|
+
version: 2.33.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -1713,7 +1713,6 @@ files:
|
|
1713
1713
|
- config/credentials.yml.enc
|
1714
1714
|
- config/i18n-tasks.yml
|
1715
1715
|
- config/initializers/pagy.rb
|
1716
|
-
- config/master.key
|
1717
1716
|
- config/routes.rb
|
1718
1717
|
- config/spring.rb
|
1719
1718
|
- db/factories.rb
|
@@ -1977,9 +1976,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1977
1976
|
version: 2.6.0
|
1978
1977
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1979
1978
|
requirements:
|
1980
|
-
- - "
|
1979
|
+
- - ">="
|
1981
1980
|
- !ruby/object:Gem::Version
|
1982
|
-
version:
|
1981
|
+
version: '0'
|
1983
1982
|
requirements: []
|
1984
1983
|
rubygems_version: 3.3.3
|
1985
1984
|
signing_key:
|
data/config/master.key
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2aeb23d82b909d9c6b5abb62f7058c2a
|