spec/support/test_model.rb in validates_timeliness-3.0.6 vs spec/support/test_model.rb in validates_timeliness-3.0.7
- old
+ new
@@ -29,34 +29,32 @@
value.send("to_#{model_attributes[attr_name.to_sym]}") rescue nil
end
end
def initialize(attributes = nil)
- @attributes = self.class.model_attributes.inject({}) do |hash, column|
+ @attributes = self.class.model_attributes.keys.inject({}) do |hash, column|
hash[column.to_s] = nil
hash
end
self.attributes = attributes unless attributes.nil?
end
def attributes
- @attributes.keys
+ @attributes
end
def attributes=(new_attributes={})
new_attributes.each do |key, value|
send "#{key}=", value
end
end
def method_missing(method_id, *args, &block)
- if !self.class.attribute_methods_generated?
- self.class.define_attribute_methods self.class.model_attributes.keys.map(&:to_s)
- method_name = method_id.to_s
+ if match_attribute_method?(method_id.to_s)
+ self.class.define_attribute_methods self.class.model_attributes.keys
send(method_id, *args, &block)
else
super
end
end
-
end