Rake Time Zones

一世执手 提交于 2019-12-13 06:24:53

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!