can't update rails model

Posted by Tristan on Stack Overflow See other posts from Stack Overflow or by Tristan
Published on 2011-01-04T00:49:47Z Indexed on 2011/01/04 3:54 UTC
Read the original article Hit count: 437

Hi there,

I'm rather new to rails. I have a controller that's attempting to update a model using the following code:

@test = Product.find(1)
@test.increment!(:price)

It does successfully retrieve the Product from the database, but does not update the price attribute. Does anyone know why this might be the case, or how I could get more feedback on what the problem is?

Thanks a bunch!
Tristan

edit: price is an integer with value 0. I get the same problem when I set the price with @test.price=50 and then @test.save .

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby