How to change Rails app time zone setting based on user's input? -
i have user model, allow user provide own time zone. user can choose own time zone using time_zone_select
. store pacific time (us & canada)
in database.
my rails 3 application default setting using pacific time (us & canada)
. time display in time zone.
may change time time display based on user time zone? example, user see time displayed in time zone central time (us & canada)
, , user b see time in london
.
thanks all.
in controllers/application.rb
before_filter :set_user_time_zone private def set_user_time_zone time.zone = current_user.time_zone if logged_in? end
from railscast
Comments
Post a Comment