Avdept
Avdept

Reputation: 2289

updating data in database on save

I'm trying to update data in database using after_create callback I wrote

Dm::Advertisement.where (:type => Dm::Advertisement).update_all(ads_counter: 0)

in my model , but have SyntaxError. Can anyone point me where i did mistake?

Upvotes: 1

Views: 106

Answers (2)

Dipak Panchal
Dipak Panchal

Reputation: 6026

Dm::Advertisement.where (:type => Dm::Advertisement).update_all(:ads_counter => 0 )

Upvotes: 1

Salil
Salil

Reputation: 47472

Dm::Advertisement.where (:type => Dm::Advertisement).update_all("ads_counter =0")

Upvotes: 1

Related Questions