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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cbfff8cdd5a6b367626522263ad2c5f2260e5d3f18b4d303136a3bee9661054
4
- data.tar.gz: 2d98da5cf89746d1d05abb2306b1f9c69ec2025ef9f48c307807e80105371e4f
3
+ metadata.gz: fc196e3fee2cace52de6c29deaf6cb48be0d0866b09150b92f2c3242a4e86dd5
4
+ data.tar.gz: 7b01b1d99127feeac10b1abaca6c31b764395545c12ddece4015c2c10f29fc57
5
5
  SHA512:
6
- metadata.gz: 46a36d35b4316a92c327505769a9e7dcf1275e0af27ef8ce87d418f76b78f0b4d7cad14da0fc6d853aa2c3fd6ded5cdb73cf6b71c5560a1d15e4f4c86fc098a6
7
- data.tar.gz: fc517cad0575f3dbee145455f2a81bba95febb42c7073d8c41e86807b8aad5d61caf2728b24f02cc4411badd85202b780005920a1630167ab638d5a17034c676
6
+ metadata.gz: d4b85f71610df01c584d9356f005184a67bc5a1baa4db74f0e74411427f01d35fd151f9b3c8258fdae85b3f37d4cbaa153ce5a77b769a316fe12e4c3405c896e
7
+ data.tar.gz: 936f608896664e6848c0ca1d059407285f4b9d09841dd16e6454a651df87ca76126cd7ff04cf4144c57a57215c080f8f7c9aa2b500554594336a361dd3e39dc7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.33.3.pre.1)
4
+ avo (2.33.3)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -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=", params["#{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 params["#{polymorphic_as}_type"].blank?
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
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.33.3.pre.1" unless const_defined?(:VERSION)
2
+ VERSION = "2.33.3" unless const_defined?(:VERSION)
3
3
  end
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.pre.1
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: 1.3.1
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