1

I'm using Rails 3 and i'm setting my time zone using this method http://railscasts.com/episodes/106-time-zones-in-rails-2-1, is there any good method to apply the time zone to all times retrieved from the system Time.now and the database without having to do something like this: Rails: get #beginning_of_day in time zone and add #in_time_zone to all of my method calls?

Are there any alternatives?

Community
  • 1
  • 1
Schneems
  • 14,918
  • 9
  • 57
  • 84

2 Answers2

0

View helpers should show times according to the application timezone. I've found that meets most of my needs when displaying dates and times. If you find that isn't working then you can explicitly specify the time zone like you have mentioned above.

Wizard of Ogz
  • 12,543
  • 2
  • 41
  • 43
0

Checkout http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html

In particular, take a look at

Time.zone.local

Does this get you headed in the right direction?

andrewpthorp
  • 4,998
  • 8
  • 35
  • 56