Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow subclasses to override the tag_list methods #297

Merged
merged 2 commits into from Jan 2, 2013

Conversation

Projects
None yet
2 participants
Contributor

jdelStrother commented Oct 11, 2012

Hi - what do you think to jdelStrother/acts-as-taggable-on@15ee393, which generates the #{tag_type}_list methods in an anonymous module, so that subclasses can override them. For example :

class TaggableModel < ActiveRecord::Base
   acts_as_taggable
   def tag_list=list
      logger.info("New list #{list.inspect}")
      super
   end
end

as opposed to :

class TaggableModel < ActiveRecord::Base
   acts_as_taggable
   def tag_list_with_logging=list
      logger.info("New list #{list.inspect}")
      self.tag_list_without_logging = list
   end
   alias_method_chain :tag_list, :logging
end

The pull request also includes jdelStrother/acts-as-taggable-on@1e78fc4 which adds FILE & LINE info to the generated methods, but I can separate that out if you like.

artemk added a commit that referenced this pull request Jan 2, 2013

Merge pull request #297 from jdelStrother/generated_methods
Allow subclasses to override the tag_list methods

@artemk artemk merged commit d659058 into mbleigh:master Jan 2, 2013

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment