The ActiveRecord extension now returns the original return value for .define_attribute_methods

This helps other extensions, like PermalinkFu, which depend on the return value
This commit is contained in:
Chris Griego 2012-01-10 17:16:05 -06:00 committed by Adam Meehan
parent 20549c7acd
commit 2702ec3266
2 changed files with 10 additions and 3 deletions

View File

@ -18,10 +18,11 @@ module ValidatesTimeliness
module ClassMethods module ClassMethods
def define_attribute_methods def define_attribute_methods
super super.tap do |attribute_methods_generated|
use_before_type_cast = ValidatesTimeliness::ORM::ActiveRecord.use_plugin_cache? use_before_type_cast = ValidatesTimeliness::ORM::ActiveRecord.use_plugin_cache?
define_timeliness_methods use_before_type_cast define_timeliness_methods use_before_type_cast
end end
end
def define_timeliness_methods(before_type_cast=false) def define_timeliness_methods(before_type_cast=false)
return if timeliness_validated_attributes.blank? return if timeliness_validated_attributes.blank?

View File

@ -119,4 +119,10 @@ describe ValidatesTimeliness, 'ActiveRecord' do
end end
end end
context "define_attribute_methods" do
it "returns a falsy value if the attribute methods have already been generated" do
Employee.define_attribute_methods.should be_false
end
end
end end