Hey guys,

Jeremy and I have been having discussions about the right way to get
time zones working in rails.

We are storing dates as UTC and displaying the time back works fine.

The problem occurs when you need to query for items on a date. We end
up with code like:

  named_scope :by_date, lambda{ |loaded_on|
    {:conditions => ["date(preferred_time + interval '10 hour') =
date(?)", loaded_on.to_date]}
  }

  NOTE: we are using postgres.

Or:

Time.zone.local_to_utc loaded_at.to_date.to_time


All of which are crap.

We are even thinking of putting this stuff into a plugin and making it
happen automagically but I struggle to believe that this problem
hasn't been solved before. In other apps that I have done before I
tend to just hack it till it works but I would really like to solve
this problem.

I'm just wondering if anyone has a nicer solution for this stuff?

Let me know?

Cheers,
Carl.


Carl Woodward
0412218979
[email protected]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to