V
V
Vayladion Gognazdiak2014-08-06 07:47:46
PostgreSQL
Vayladion Gognazdiak, 2014-08-06 07:47:46

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

controller:
def update_last_login
   @subscriber = Subscriber.where( "email = ?",params[:email] ).first
   @subscriber.last_login_at = Time.now
   @subscriber.save
end

1ms) COMMIT This does not update the last_login_at field. Where to dig? Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jeiwan, 2014-08-06
@Jeiwan

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 question

Ask a Question

731 491 924 answers to any question