# Record update problem - empty SET clause

**URL:** <https://www.ruby-forum.com/t/record-update-problem-empty-set-clause/119527>\
**Category:** Rails\
**Created:** [November 7, 2007, 7:09pm UTC](https://www.ruby-forum.com/t/record-update-problem-empty-set-clause/119527 "2007-11-07T19:09:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [November 7, 2007, 7:09pm UTC](https://www.ruby-forum.com/t/record-update-problem-empty-set-clause/119527/1 "2007-11-07T19:09:34Z")

</div>

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!
