spec/support/test_model.rb in validates_timeliness-5.0.1 vs spec/support/test_model.rb in validates_timeliness-6.0.0.alpha1
- old
+ new
@@ -13,14 +13,14 @@
def attribute(name, type)
self.model_attributes ||= {}
self.model_attributes[name] = type
end
- def define_method_attribute=(attr_name)
+ def define_method_attribute=(attr_name, owner: nil)
generated_attribute_methods.module_eval("def #{attr_name}=(new_value); @attributes['#{attr_name}']=self.class.type_cast('#{attr_name}', new_value); end", __FILE__, __LINE__)
end
- def define_method_attribute(attr_name)
+ def define_method_attribute(attr_name, owner: nil)
generated_attribute_methods.module_eval("def #{attr_name}; @attributes['#{attr_name}']; end", __FILE__, __LINE__)
end
def type_cast(attr_name, value)
return value unless value.is_a?(String)