Дано:
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
rails (4.0.0)
activemodel (4.0.0)
activerecord (4.0.0)
БД: PG
Имеется код:
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
last_login_at имеет тип timestamp
Лог:
Subscriber Load (28.9ms) SELECT "subscribers".* FROM "subscribers" WHERE (email = 'test@test.com') ORDER BY "subscribers"."id" ASC LIMIT 1
(0.2ms) BEGIN
Subscriber Exists (37.3ms) SELECT 1 AS one FROM "subscribers" WHERE ("subscribers"."email" = 'test@test.com' AND "subscribers"."id" != 65307) LIMIT 1
SQL (0.9ms) UPDATE "subscribers" SET "last_login_at" = $1, "updated_at" = $2 WHERE "subscribers"."id" = 65307 [["last_login_at", Wed, 06 Aug 2014 04:23:04 UTC +00:00], ["updated_at", Wed, 06 Aug 2014 04:23:04 UTC +00:00]]
(1.1ms) COMMIT
При этом поле last_login_at не обновляется. Куда копать?
Заранее спасибо за ответ.