how to edit a pluggin? (acts_as_taggable_on)

Hello,

I'm trying to modificate the acts_as_taggable_on pluggin, so when you search various tags (Eg: User.tagged_with("fish, cat", :on => :animals), it looks for users with BOTH tags, not just one of them.

I have edited the file acts_as_taggable_on.rb and I have changed the line: "conditions << tags.map { |t| sanitize_sql(["#{tags_alias}.name LIKE ?", t]) }.join(" OR ")" with ""conditions << tags.map { |t| sanitize_sql(["#{tags_alias}.name LIKE ?", t]) }.join(" AND ")". but when I execute the search, the sql sentence that is executed is the same than before.

I just restarted the console after doing the changes, do I have to do something else so the changes take effect? (I installed the plugin through GemPlugins)

Or maybe I'm editing the wrong line?...if someone has done this before please correct me if I'm wrong!

Thanks!

In case someone has the same problem:

I have executed: rake gems:unpack So now the plugin is in the vendors/gem directory inside my rails proyect and when I edit it there, the changes take effect.

However I haven't been able to obtain the functionality that I was looking for in acts_as_taggable_on with the change I made...any ideas?

Try using the IN sql operator. Unless you are using wildcards i think in should work.

ie name IN (‘fish’,‘frog’)

You will need to change your code.

# Options:         # :exclude - Find models that are not tagged with the given tags         # :match_all - Find models that match all of the given tags, not just one         # :conditions - A piece of SQL conditions to add to the query         # :on - scopes the find to a context

Model.find_tagged_with("tag1, tag2", :on => :context1, :match_all => true)