Re: Error on updateing!

Roderick van Domburg
Thu, 18 Jan 2007 09:24:08 -0000

> Hi all, I have what is a very basic application and I''m try to
update
> some records but when I do I get an error saying:
>
> Options does not specify :except or :only (["name",
"description"])
>
> with the offending code:
>
>   def update
>     category = Category.find(params[:category_id])
>     category.attributes(params[:category])
>     category.save
>     redirect_to(:action => "list")
>   end
>
> category_id and params[:category] seem to be correct and the
> documentation doesn''t specify anything else. Any ideas what going
> wrong?

You have to replace that third line with:

  category.attributes = params[:category]

But I prefer the notation of the default scaffold that uses
#update_attributes. Depending on what you''re submitting to that action,
params[:category_id] might not work and you''ll have to use params[:id]
instead.

Roderick

--
Nedforce Informatica Specialisten B.V.
http://www.nedforce.nl
+31 (0)53 4500225

--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---