I have a Problem in my Rails application.
I’ve left everything at standard Rails configuration, so no config.time_zone is set, …
Problem now is:
Given I have a database entry like this:
c = Client.first
=> #<Client id: 1, short: "Test", last_connected_at: "2011-06-21 09:22:58">
now I generate a Time-Object:
t = Time.zone.parse("2011-06-21 09:22:58")
double check it:
c.last_connected_at
=> Tue, 21 Jun 2011 09:22:58 UTC +00:00
t
=> Tue, 21 Jun 2011 09:22:58 UTC +00:00
So it is identical, but
c.last_connected_at == t => false
Why??? That makes it really hard to find a database row by date.
Thanks a lot for your help.
It’s a caveat. According to the ruby-docs:
c.last_connected_at.to_i == t.to_ishould work.