Hello list,

In ref. to my previous post: 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
<h1>New <%= @is_subitem ? 'Subitem' : 'Item' %></h1>
<% 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.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to