mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +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
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
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
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
@ -25,6 +27,10 @@ module ValidatesTimeliness
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
module BeforeTypeCastMethods
|
||||||
|
|
||||||
def define_method_attribute_before_type_cast(attr_name)
|
def define_method_attribute_before_type_cast(attr_name)
|
||||||
if timeliness_validated_attributes.include?(attr_name)
|
if timeliness_validated_attributes.include?(attr_name)
|
||||||
method_body, line = <<-EOV, __LINE__ + 1
|
method_body, line = <<-EOV, __LINE__ + 1
|
||||||
@ -39,5 +45,6 @@ module ValidatesTimeliness
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user