# Howto: Add my own functionality to a plugin?

**URL:** <https://www.ruby-forum.com/t/howto-add-my-own-functionality-to-a-plugin/175464>\
**Category:** Rails\
**Created:** [September 14, 2009, 11:33am UTC](https://www.ruby-forum.com/t/howto-add-my-own-functionality-to-a-plugin/175464 "2009-09-14T11:33:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [September 14, 2009, 11:33am UTC](https://www.ruby-forum.com/t/howto-add-my-own-functionality-to-a-plugin/175464/1 "2009-09-14T11:33:37Z")

</div>

The plugin in this case is acts\_as\_taggable\_on\_steroid, which has  
classes Tag, Tagging and TagList, and a module  
ActiveRecord::Acts::Taggable which adds the acts\_as\_taggable method to  
all classes (so that when the call it they have some other modules  
included at the class and instance level, giving them the acts as  
taggable methods).

I have some extra methods i want to add to the Tag class and also to to  
taggable classes. But, i can’t work out how to set this up in such a  
way as my additional Tag methods sit on top of the exisiting Tag  
methods, for example.

There must be a standard procedure for this situation - can anyone help  
me out? (i’m guessing the best practise isn’t to physically add my own  
methods into the plugin’s classes/modules)

Thanks  
max

The plugin has this structure for the acts\_as\_taggable methods -

module ActiveRecord #:nodoc:  
module Acts #:nodoc:  
module Taggable #:nodoc:  
def self.included(base)  
base.extend(ClassMethods)  
end

```
  module ClassMethods
    def acts_as_taggable
      has_many :taggings, :as => :taggable, :dependent => :destroy,

```

:include =\> :tag  
has\_many :tags, :through =\> :taggings

```
      before_save :save_cached_tag_list

      after_create :save_tags
      after_update :save_tags

      include ActiveRecord::Acts::Taggable::InstanceMethods
      extend ActiveRecord::Acts::Taggable::SingletonMethods

      alias_method_chain :reload, :tag_list
    end

    ...
  end

  module SingletonMethods
    ...
  end

  module InstanceMethods
    ...
  end
end

```

end  
end

ActiveRecord::Base.send(:include, ActiveRecord::Acts::Taggable)
