I want to get an object that gets ActiveRecord in the last 10 seconds
I did this Tried
@chats = Chat.find (: all, conditions => ["updated_at>"? ", 10.seconds.ago])
< / Pre>as well as
@chats = Chat.find (: all ,: conditions => ["update_at>"? ", Time is -10. seconds ])
and even
@chats = Chat.find (: all ,: conditions => {: updated_at = & amp; Gt; 10.seconds.ago..0.seconds.ago}]
But I still can not get it to work: (
Edit Please: I'm updating this column to keep it alive from any other application and I'm looking at all the lines that have survived in the last 10 seconds so that dead chat can be settled.
Are you really questioning the correct column? I think you may need to see the created_at timestamp instead . I do not know your application, but I am surprised that you are updating the existing chat, rather than just putting new ones.
So ... if my assumption is correct, then it should be the MIG HT you want:
@chats = Chat.find (: all ,: conditions = & Gt; ["created_t> ??", 10.seconds.ago])
If not ... please provide some more information. The query should work with you, and I guess update_at is not updating.
Comments
Post a Comment