On 7 Dec 2011, at 12:14, Mathew Birch <[email protected]> wrote:

> Thanks for your reply!
> 
> Well since the same problem arises with the Item object.. I will post 
> the errors from there:
> 
> TypeError in Items#edit
> 
> Showing ItemCollection/app/views/items/_form.html.erb where line #1 
> raised:
> 
> nil is not a symbol
> Extracted source (around line #1):
> 
> 1: <%= form_for(@item) do |f| %>


So, at the risk of repeating myself, is @item nil?

Fred

> 2:   <% if @item.errors.any? %>
> 3:     <div id="error_explanation">
> 4:       <h2><%= pluralize(@item.errors.count, "error") %> prohibited 
> this item from being saved:</h2>
> 
> From the controller file:
> def edit
>  @item = Item.find_by_id(params[:id])
> end
> 
> The interesting thing is that show method works with the following code:
>  def show
>    @item = Item.find_by_id(params[:id])
>    respond_to do |format|
>      format.html # show.html.erb
>      format.json { render json: @item }
>    end
>  end
> 
> I tried adding the respond_to part to edit method and changed the show 
> to edit but it still produces the same error.
> 
> -- 
> 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.
> 

-- 
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