mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
before_type_cast fix for ORMs not using it wont create
This commit is contained in:
parent
9347eadce8
commit
30fb0e5192
@ -3,7 +3,9 @@ module ValidatesTimeliness
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
attribute_method_suffix "_before_type_cast"
|
||||
if attribute_method_matchers.any? {|m| m.suffix == "_before_type_cast" && m.prefix.blank? }
|
||||
extend BeforeTypeCastMethods
|
||||
end
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
@ -25,6 +27,10 @@ module ValidatesTimeliness
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
module BeforeTypeCastMethods
|
||||
|
||||
def define_method_attribute_before_type_cast(attr_name)
|
||||
if timeliness_validated_attributes.include?(attr_name)
|
||||
method_body, line = <<-EOV, __LINE__ + 1
|
||||
@ -39,5 +45,6 @@ module ValidatesTimeliness
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user