# Problem with posting with acts as taggable on steroids

**URL:** <https://www.ruby-forum.com/t/problem-with-posting-with-acts-as-taggable-on-steroids/130261>\
**Category:** Rails\
**Created:** [February 26, 2008, 9:41pm UTC](https://www.ruby-forum.com/t/problem-with-posting-with-acts-as-taggable-on-steroids/130261 "2008-02-26T21:41:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flychunjae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ab097/32.png) [@flychunjae](https://www.ruby-forum.com/u/flychunjae)\
**Post date:** [February 26, 2008, 9:41pm UTC](https://www.ruby-forum.com/t/problem-with-posting-with-acts-as-taggable-on-steroids/130261/1 "2008-02-26T21:41:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![flychunjae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ab097/32.png) [@flychunjae](https://www.ruby-forum.com/u/flychunjae)\
**Post date:** [February 26, 2008, 11:01pm UTC](https://www.ruby-forum.com/t/problem-with-posting-with-acts-as-taggable-on-steroids/130261/2 "2008-02-26T23:01:33Z")

</div>

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
