Problem with posting with acts as taggable on steroids

hi all

i’m trying to have a post with tags included but i’m getting
undefined method `tag_with’

i’ve already added acts_as_taggable to the model

and on the controller the code for creating the post is:

def create
@post = Post.new(params[:post])
@post.tag_with(params[:tag_list])
@post.user = current_user
if @post.save
redirect_to root_url
else
render :action => ‘new’
end
end

and the form on the view has the tagging code:

Tags
<%= text_field_tag 'tag_list', @post.tags.collect{|t| t.name}.join(" ") %>

since the acts_as_taggable is in the model i don’t see why it would give
me undefined method.

any help would be greatly appreciateddd thank youu

You might want to have a look at the readme in the
vendor/plugins/acts_as_taggable_on_steroids directory.

You will read the text hereafter.
In short : there is not tag_with method.
To add a tag do : p.tag_list.add(“Great”, “Awful”)

=== Basic tagging

Let’s suppose users have many posts and we want those posts to have
tags.
The first step is to add +acts_as_taggable+ to the Post class:

class Post < ActiveRecord::Base
acts_as_taggable

belongs_to :user

end

We can now use the tagging methods provided by acts_as_taggable,
#tag_list and #tag_list=. Both these
methods work like regular attribute accessors.

p = Post.find(:first)
p.tag_list # []
p.tag_list = “Funny, Silly”
p.save
p.tag_list # [“Funny”, “Silly”]

You can also add or remove arrays of tags.

p.tag_list.add(“Great”, “Awful”)
p.tag_list.remove(“Funny”)

H

Richard Y. wrote:

hi all

i’m trying to have a post with tags included but i’m getting
undefined method `tag_with’

i’ve already added acts_as_taggable to the model

and on the controller the code for creating the post is:

def create
@post = Post.new(params[:post])
@post.tag_with(params[:tag_list])
@post.user = current_user
if @post.save
redirect_to root_url
else
render :action => ‘new’
end
end

and the form on the view has the tagging code:

Tags
<%= text_field_tag 'tag_list', @post.tags.collect{|t| t.name}.join(" ") %>

since the acts_as_taggable is in the model i don’t see why it would give
me undefined method.

any help would be greatly appreciateddd thank youu