Unfortunately this does not work for me. The issue is that the code in the ApplicationController is not being invoked at all. Somehow the before_filter instruction does not seem to work.
The very same code in any other controller works fine... On 24 Mai, 19:37, kevinpfromnm <[email protected]> wrote: > This is what I ended up using for my project: > > before_filter:set_time_zone > > private > def set_time_zone > Time.zone = 'UTC' > Time.zone = current_user.timezone if current_user.signed_up? and ! > current_user.timezone.blank? > end > > On May 24, 4:25 am, ChrisBee <[email protected]> wrote: > > > > > How can I use abefore_filterin the ApplicationController? My code > > (below) does work in any controller, but not the > > ApplicationController, where the set_time_zone method is not being > > invoked. What am I doing wrong? > > > Any help is greatly appreciated! > > > class ApplicationController < ActionController::Base > > > helper :all # include all helpers, all the time > > protect_from_forgery # See > > ActionController::RequestForgeryProtection for details > > > # Scrub sensitive parameters from your log > > # filter_parameter_logging :password > > > before_filter:set_time_zone > > > def set_time_zone > > puts "*** Application Controllerbefore_filter" > > user_tz = @current_user.try.time_zone > > Time.zone = user_tz if user_tz > > end > > > end > > > -- > > You received this message because you are subscribed to the Google Groups > > "Hobo Users" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/hobousers?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Hobo Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/hobousers?hl=en. -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
