1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Moved squawk method into LocalInstanceMethods module, so it would

not be added to every ActiveRecord::Base object.  Changed acts_as_yaffle
so it will include the LocalInstanceMethods module.  Now only
models that call acts_as_yaffle will get the squawk method, instead
of pushing them into every ActiveRecord::Base.
This commit is contained in:
Mike Mulvaney 2012-03-16 15:53:16 -04:00
parent 2dd486ceb5
commit f820098f9e

View file

@ -362,13 +362,16 @@ module Yaffle
def acts_as_yaffle(options = {})
cattr_accessor :yaffle_text_field
self.yaffle_text_field = (options[:yaffle_text_field] || :last_squawk).to_s
include Yaffle::ActsAsYaffle::LocalInstanceMethods
end
end
def squawk(string)
write_attribute(self.class.yaffle_text_field, string.to_squawk)
module LocalInstanceMethods
def squawk(string)
write_attribute(self.class.yaffle_text_field, string.to_squawk)
end
end
end
end