Rails 3: setting the timezone to the current users timezone
ruby-on-rails, timezone
Solution
Max -- the ryandaigle.com article you mentioned links to this writeup where you need to create a migration to add "time_zone" as an attribute to the user
(this is from the article, in rails 2.x syntax)
$ script/generate scaffold User name:string time_zone:string
$ rake db:migrate
later
<%= f.time_zone_select :time_zone, TimeZone.us_zones %>
That's why your .time_zone is returning a method_missing -- you haven't stored the time_zone on the user yet.
Problem
I put this in Application Controller: ``` before_filter :set_timezone def set_timezone Time.zone = current_user.time_zone end ``` But I always get the error: ``` undefined method time_zone for #<User:0xa46e358> ``` and I just don't know why... I hope someone can help