has_safe_dates 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: b7568105303c5f9d5c1b89473f2285b06e7c3edc
4
- data.tar.gz: 5b5d33acc5958d838bdec27cef14a0ac7c148058
3
+ metadata.gz: 1706f8d6cdbbd3d98e0fd78162be5d1a7e85c4f7
4
+ data.tar.gz: 5caf2882827bb4717238fa46fd553a18df1148e7
5
5
  SHA512:
6
- metadata.gz: 744066114fa7efe60a406f1bdbae48b90d6127ead6c021646c208adf391fa899808f0bf7b7e441881d232cd34ccf86237cd13797046a8356778362c466319932
7
- data.tar.gz: 0043062b200e8a6d55f241ef4a9ec5f6c87bd7b3a25dd65b2d4ee1e3ad52a41453d4a137321372a3363dbd02c783b242c0e8f708e1c5f300e077044a30aa6cc2
6
+ metadata.gz: 9bff2a615d7ce86c75221117ed9ee75067bc62bd88c2fbd871ed6ff0e44ab31619cb707d78e1284ec3940e1192b38cccd0e32f57db2dd28d1fe092d59cc0fe12
7
+ data.tar.gz: 2fc82cd206c61761404981f6a73b98c757dabeaae97d2b84f9e688f0c0949655f8f54e3a7aeb659b93c368ce58b9fd3096ed492a49aeecf7b5d136ccad2c95b0
@@ -29,9 +29,9 @@ module HasSafeDates
29
29
  define_method "#{field.to_s}=" do |value|
30
30
  if value.present?
31
31
  value = Chronic.parse(value.to_s)
32
- if value.blank? && self.class.has_safe_fields_config[self.class][:error_message].present?
32
+ if value.blank? && self.class.has_safe_fields_config[self.class.base_class][:error_message].present?
33
33
  @safe_date_validation_errors ||= {}
34
- @safe_date_validation_errors[field] = self.class.has_safe_fields_config[self.class][:error_message]
34
+ @safe_date_validation_errors[field] = self.class.has_safe_fields_config[self.class.base_class][:error_message]
35
35
  end
36
36
  end
37
37
  super value
@@ -58,7 +58,7 @@ module HasSafeDates
58
58
  # Overrides #read_date when has_safe_dates is enabled for the current field the multiparameter.
59
59
  # Otherwise the original #read_date method is invoked.
60
60
  def read_date
61
- if ActiveRecord::Base.has_safe_fields_config[object.class] && ActiveRecord::Base.has_safe_fields_config[object.class][:fields].include?(name)
61
+ if ActiveRecord::Base.has_safe_fields_config[object.class.base_class] && ActiveRecord::Base.has_safe_fields_config[object.class.base_class][:fields].include?(name)
62
62
  values.values_at(1,2,3).join("-") # Convert multiparameter parts into a Date string, e.g. "2011-4-23", return it, and allow CoreExt methods handle the result.
63
63
  else
64
64
  super # has_safe_dates is not enabled for the current field, so invoke the super method (original #read_date method).
@@ -1,3 +1,3 @@
1
1
  module HasSafeDates
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_safe_dates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - kylejginavan