From: Tim Pease Date: 2006-10-27T00:42:20+09:00 Subject: Re: auto_increment model method wont increment but no error ? On 10/26/06, Ruben D. Orduz wrote: > Dan, > > Your schema/model need work. What you need to do is retrieve the value of > eat that corresponds with the param[:id] increment it (within your code [eat > += 1;]), and then store it back to the DB. Else what might be going on is > that you're telling the DB to create a new record with the counter and eat > incremented. There's no point in having the field eat to auto_increment if > it's not going to be a key of the relation. That is, eat will not uniquely > identify the row, thus you should not have it as an implicit key. If you > don't want to write one more line of code in your code...you can write 6 > lines and create a stored procedure in the DB (if your DB supports it) ;) > Dan, take a look at the documentaiton on the ActiveRecord "increment!" method. I think this does what you just described. Blessings, TwP