Hey everyone! Just have a quick question, im writing a method to
update a field specified through an ajax edit in place, (i dont want
to write one method for every single field, so im going more generic)
currently im receiving the field name in params[:field] i want to do
something like
What gets passed back from the form is params which is a hash. So when you say params[:value] you are asking for the value associated with the key :value.
the way update_attributes works is it expects a hash but it expects a hash that in this case would look like this:
{:name => “john”} so if you were to say User.update_attributes({:name => “john”) it should work.
you could also use update_attribute (singular which will do what you are expecting.
(I could be grossly mistaken about all of this - its late and the coffee machine stopped working
regards
ivor
btw, write some garbage at the first line after “def actionname” in your action that you post to and check the log - it will show you what params looks like.