Answer the question
In order to leave comments, you need to log in
Why doesn't update work in PG?
Given:
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
rails (4.0.0)
activemodel (4.0.0)
activerecord (4.0.0)
DB: PG
Code available:
Routes:
resources :subscribers do
collection do
post :update_last_login
end
end
def update_last_login
@subscriber = Subscriber.where( "email = ?",params[:email] ).first
@subscriber.last_login_at = Time.now
@subscriber.save
end
Answer the question
In order to leave comments, you need to log in
And updated_at is updated?
Suspicious commas after Wed:
SQL (0.9ms) UPDATE "subscribers" SET "last_login_at" = $1, "updated_at" = $2 WHERE "subscribers"."id" = 65307 In
general, the date format is strange. I tried updating updated_at with Time.now:
SQL (0.6ms) UPDATE "sellers" SET "updated_at" = $1 WHERE "sellers"."id" = 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question