Forum: Ruby on Rails Acts_as_Taggable

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1b275ea705cc1671f13105d29684cbec?d=identicon&s=25 Scott Walter (sfwalter)
on 2006-04-07 04:47
(Received via mailing list)
A couple of quick acts_as_taggable (the Rails 1.1 plugin version)

1.  Can you update tags on an existing record?

If I execute the tag_with statement twice it creates two rows in the
taggings column, instead of updating the value of the existing tag

2.  Can you delete tags?  I didn't see a method for this.  If I can
delete tags, problem #1 goes away.

scott.

----------------------------------------------------------------------------------------------------
What's an Intel chip doing in a Mac? A whole lor more that it's ever
done in a PC.

My Digital Life - http://scottwalter.com/blog
Pro:Blog - http://scottwalter.com/problog
0091f92762685860109bbcb02edfdf27?d=identicon&s=25 Alain Ravet (Guest)
on 2006-04-07 14:15
(Received via mailing list)
Scott
    > 1.  Can you update tags on an existing record?
    > If I execute the tag_with statement twice it creates two rows in
the
    > taggings column, instead of updating the value of the existing tag


I use tag_with  (see example below) to update objects tags, and I didn't
notice any data duplication.


1/In the view (edit.rhtml)
---------------------------------
    <%= text_field_tag "tag_list", @entity.tags.collect {|tag|
tag.name}.join(' ') }%>


2/ in the controller (def update)
---------------------------------
     def update
         ...
         @entity.tag_with(params[:tag_list])
         @entity.save
         ...

Alain
This topic is locked and can not be replied to.