# Undefined variable or method in form\_tag url

**URL:** <https://www.ruby-forum.com/t/undefined-variable-or-method-in-form-tag-url/162300>\
**Category:** Rails\
**Created:** [March 8, 2009, 9:27am UTC](https://www.ruby-forum.com/t/undefined-variable-or-method-in-form-tag-url/162300 "2009-03-08T09:27:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neubyr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/c37758/32.png) [@neubyr](https://www.ruby-forum.com/u/neubyr)\
**Post date:** [March 8, 2009, 9:27am UTC](https://www.ruby-forum.com/t/undefined-variable-or-method-in-form-tag-url/162300/1 "2009-03-08T09:27:07Z")

</div>

Hello list,

In ref. to my previous post: [RESTful nested resources and polymorphism? - Rails - Ruby-Forum](http://www.ruby-forum.com/topic/180765)

I am getting “undefined local variable or method `item\_path’ for  
#ActionView::Base:0xb7065650”, when I try to create a new item.  
Following is the code in my new.rhtml

# New \<%= @is\_subitem ? 'Subitem' : 'Item' %\>
\<% form\_tag :item, :url =\> item\_path do %\> \<%= render :partial =\> 'item\_form' %\> \<%= submit\_tag "Create" %\> \<% end %\>

The new and create actions are as follows:  
def new  
@item = Item.new  
end

def create  
@item = Item.new(params[:items])  
@topic = Topic.find(params[:topic\_id])  
@item.topic = @topic  
@item.position = @topic.items.size  
respond\_to do |format|  
if @item.save  
flash[:notice] = “Item was successfully created.”  
format.html { redirect\_to item\_url(@item.topic,@item) }  
format.xml { head :created, :location =\>item\_url(@item.topic,  
@item) }  
else  
format.html { render :action =\> “new” }  
format.xml { render :xml =\> @item.errors.to\_xml }  
end  
end  
end

Where is the problem? Any clues?  
Also any help on RESTful nested resources and self-referential  
associations?

Thanks,  
CS.
