gwaldron-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Nov-07 18:08 UTC
Record update problem - empty SET clause
Hi, Hopefully someone can help with what is probably a simple question. I have a simple model, initially created as a scaffold, and the "update" action does not seem to work. I set the following error: Mysql::Error: #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''WHERE `id` = 9'' at line 1: UPDATE layers SET WHERE `id` = 9 Clearly, the SQL is bad since the "SET" clause is empty! Here is the code in the controller: def update @layer = Layer.find(params[:id]) if @layer.update_attributes(params[:layer]) flash[:notice] = ''Layer was successfully updated.'' redirect_to :action => ''show'', :id => @layer else render :action => ''edit'' end end The request parameters look like this, according to the log: Parameters: {"commit"=>"Save changes", "id"=>"9", "layer"=>{"name"=>"incidents", "uri"=>"c:/file.txt", "fnameattr"=>"name", "description"=>"Test Map"}} The database table looks right and the fields seem correct. Can anyone help with this one? Thanks in advance! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---