问题
How would I add a new time zone to the list of time zones?
If I would have to simply add a time zone to my system, why doesn't it appear on the list:
rake time:zones:all
As mentioned by ranja below, I tried to use ActiveSupport with time zones.
So I open up the console
user@host:/var/www/project$ irb
irb(main):001:0> require 'active_support'
=> true
irb(main):002:0>
But what should I use next? And will the new time zone be lost? How would I implement a permanent new ruby time zone which would be available on all my aps? Thanks so far!
回答1:
In your rails console type below command , you can get list of name
ActiveSupport::TimeZone.all.map(&:name)
回答2:
Please try this in application.rb for rails 3.X and enviroment.rb in rails 2.x
config.time_zone = 'Eastern Time (US & Canada)'
after that do
rake time:zones:all
Thanks
来源:https://stackoverflow.com/questions/17081491/rake-time-zones