before_type_cast fix for ORMs not using it wont create

This commit is contained in:
Adam Meehan 2010-08-10 15:41:53 +10:00
parent 9347eadce8
commit 30fb0e5192

View File

@ -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