Error on updateing!

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?

Thanks!

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs