Musdev Musdev wrote:
> I get the following error inside my browser:
> ActiveRecord::RecordNotFound in ProductsController#show
>
> Couldn't find Product without an ID
>
>
> Request
>
> Parameters:
>
> {"id"=>"2"}
>
> The code on line 17 in my controller looks like this
>
> def show
> @product = Product.find(params[:id => "show"])
>
> respond_to do |format|
> format.html {render show.html.erb}
> format.xml #{ render :xml => @product }
> end
> end
>
> I'm new to rails and i cannot pinpoint where my issue is occurring
> Can someone please give me a hand
>
> Thank you
Hi,
Your code should be like this,
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html {render show.html.erb}
format.xml #{ render :xml => @product }
end
end
Thanks,
Anubhaw
--
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.