Skip to content

Question on setting the tag owner #111

customersure opened this Issue Sep 23, 2010 · 2 comments

2 participants


I would like all tags in a particular model to be owned by the overall account. I'm sure with the ownership this is possible, but looking through the source code I can't really see an easy way to do it. Could someone help point me in the right direction please?

Currently I'm doing this:

# In a taggable model:
before_save :set_tag_owner
def set_tag_owner
    # Set the owner of some tags based on the current tag_list
    set_owner_tag_list_on(account, :tags, self.tag_list)
    # Clear the list so we don't get duplicate taggings
    tag_list = nil

# In the view:
<%= f.text_field :tag_list, :value => @obj.all_tags_list %>
artemk commented Dec 18, 2011

The only workaround that i can suggest you is
User.find(:first).tag( @model, :with => params[:model].delete(:tag_list), :on => :tags )

which will prevent from double saving tags.

@artemk artemk closed this Dec 18, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.