From f820098f9ef8fe6e1a5f188d01c3eb2586c5546e Mon Sep 17 00:00:00 2001 From: Mike Mulvaney Date: Fri, 16 Mar 2012 15:53:16 -0400 Subject: 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. --- railties/guides/source/plugins.textile | 9 ++++++--- 1 file 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 -- cgit v1.2.3