diff options
author | Mike Mulvaney <mike.mulvaney@gmail.com> | 2012-03-16 15:53:16 -0400 |
---|---|---|
committer | Mike Mulvaney <mike.mulvaney@gmail.com> | 2012-03-16 15:53:16 -0400 |
commit | f820098f9ef8fe6e1a5f188d01c3eb2586c5546e (patch) | |
tree | dba8fd55bb22a1b5f13d229385225d7565da5cae /railties/guides/source | |
parent | 2dd486ceb568b6bd18825f947e6e936203eaabd8 (diff) | |
download | rails-f820098f9ef8fe6e1a5f188d01c3eb2586c5546e.tar.gz rails-f820098f9ef8fe6e1a5f188d01c3eb2586c5546e.tar.bz2 rails-f820098f9ef8fe6e1a5f188d01c3eb2586c5546e.zip |
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.
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/plugins.textile | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index 5d2f0917b7..97b4eca779 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -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 |