When i am trying to use Time.zone.now it gives me an error which shows that Time.zone is nill because i did not mentioned config.time_zone in my environment file and when i am doing , my server is not getting started and giving me an error.
initialize_time_zone’: Value assigned to config.time_zone not recognized.Run “rake -D time” for a list of tasks for finding appropriate time zone names. (RuntimeError)
I am using
rails -v Rails 2.3.11
ruby -v ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
rvm -v rvm 1.6.23 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
* LOCAL GEMS *
actionmailer (2.3.11)
actionpack (2.3.11)
activerecord (2.3.11)
activeresource (2.3.11)
activesupport (2.3.11)
archive-tar-minitar (0.5.2)
bluecloth (2.1.0)
builder (3.0.0)
columnize (0.3.4)
escape (0.0.4)
fastercsv (1.5.4)
hpricot (0.8.4)
linecache19 (0.5.12)
mime-types (1.16)
mysql (2.8.1)
nokogiri (1.5.0)
pr_geohash (1.0.0)
rack (1.1.2)
rails (2.3.11)
rake (0.8.7)
RedCloth (4.2.7)
rsolr (0.12.1)
ruby-debug-base19 (0.11.25)
ruby-debug19 (0.11.6)
ruby_core_source (0.1.5)
sunspot (1.2.1)
sunspot_rails (1.2.1)
will_paginate (2.3.15)
Thanks
Nishant
If we are not mentioning the Time.zone in the environment file , it will be UTC by default. I have mentioned config.active_record.default_time zone as :utc and this was working fine in ruby 1.8.7 but when i have changed that to ruby 1.9.2 its causing problems.
You have to set explicitly your time zone in you config file if you want to use
Time.zone. There seems to be no default value.In
config/environment.rb:To get a list of all available time zones with their UTC offset run