Hey i have this testing action in my controller
def update_paids
o = Order.find(6)
o.paid=false
o.save!
end
and i can’t get it to work, changes are not pushed to database! ive
also tried to do this by update_attributes method, no effect as well.
I have attr_accessor :paid in Order model.
When i look on server log i only see query that loads model (i
confirmed it finds correct object)
Order Load (62.8ms) SELECT “orders”.* FROM “orders” WHERE
“orders”.“id” = ? LIMIT 1 [[“id”, 6]]
there is no update or any other query after that.
What’s wrong?
On Sun, Feb 12, 2012 at 9:43 AM, Marcin S [email protected] wrote:
I have attr_accessor :paid in Order model.
When i look on server log i only see query that loads model (i
confirmed it finds correct object)
Order Load (62.8ms) SELECT “orders”.* FROM “orders” WHERE
“orders”.“id” = ? LIMIT 1 [[“id”, 6]]
there is no update or any other query after that.
What’s wrong?
Is that action routed?
–
Leonardo M…
There’s no place like ~
On 12 February 2012 12:43, Marcin S [email protected] wrote:
I have attr_accessor :paid in Order model.
You should not have attr_accessor for a db column (I presume it is in
the db). That will provide accessor methods that override the access
to the db column, effectively replacing it with a simple instance
method. You might mean attr_accessible. I guess you are seeing
nothing in the log as the record has not changed so it does not save
it.
Colin
2012/2/12 Colin L. [email protected]:
also tried to do this by update_attributes method, no effect as well.
I have attr_accessor :paid in Order model.
You should not have attr_accessor for a db column (I presume it is in
the db). That will provide accessor methods that override the access
to the db column, effectively replacing it with a simple instance
method. You might mean attr_accessible. I guess you are seeing
nothing in the log as the record has not changed so it does not save
it.
Thanks You that was it!