I am working on accommodating time-zones with the following tutorial on caboose.se: http://blog.caboo.se/articles/2007/2/23/adding-timezone-to-your-rails-app It requires installation of tztime and tzinfo_timezone plugins. I seem to have successfully installed these plugins and they appear in my vendor/plugins directory. I''ve tried to use this plugin in my application the way the tutorial recommends: class ApplicationController < ActionController::Base around_filter :set_timezone private def set_timezone TzTime.zone = current_user.tz yield TzTime.reset! end end But I get the error: "uninitialized constant ApplicationController::TzTime" on the "TzTime.zone =" line. Am I skipping a step to install the tztime plugin? I don''t have to move vendor/plugins/tztime/lib/tz_time.rb to app/models directory, do I? Thanks, Peter -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Did you restart your server? --Michael On 10/28/07, Peter Marks <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I am working on accommodating time-zones with the following tutorial on > caboose.se: > > http://blog.caboo.se/articles/2007/2/23/adding-timezone-to-your-rails-app > > It requires installation of tztime and tzinfo_timezone plugins. I seem > to have successfully installed these plugins and they appear in my > vendor/plugins directory. I''ve tried to use this plugin in my > application the way the tutorial recommends: > > class ApplicationController < ActionController::Base > around_filter :set_timezone > private > > def set_timezone > TzTime.zone = current_user.tz > yield > TzTime.reset! > end > > end > > But I get the error: "uninitialized constant > ApplicationController::TzTime" on the "TzTime.zone =" line. Am I > skipping a step to install the tztime plugin? I don''t have to move > vendor/plugins/tztime/lib/tz_time.rb to app/models directory, do I? > > Thanks, > > Peter > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Graff wrote:> Did you restart your server? > > --Michaelyes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Well, then, that''s obviously not the problem. :) Run script/console, and try this:>> TzTime.zone=> #<TzinfoTimezone:0xb9d83e34 @utc_offset=-21600, @name="Central Time (US & Canada)"> Do you get that output? I have this in my config/environment.rb file: # Use tzinfo library to convert to and from the users timezone gem ''tzinfo'' include TZInfo TzTime.zone = TimeZone[''Central Time (US & Canada)''] # This makes Time.now return time in UTC ENV[''TZ''] = ''UTC'' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Graff wrote:> Well, then, that''s obviously not the problem. :) > > Run script/console, and try this: > >>> TzTime.zone > => #<TzinfoTimezone:0xb9d83e34 @utc_offset=-21600, @name="Central Time > (US & Canada)"> > > Do you get that output? > > I have this in my config/environment.rb file: > > # Use tzinfo library to convert to and from the users timezone > gem ''tzinfo'' > include TZInfo > > TzTime.zone = TimeZone[''Central Time (US & Canada)''] > > # This makes Time.now return time in UTC > ENV[''TZ''] = ''UTC''I get "nil" as a response to "TzTime" from console. When I put what you have into my own environment.rb file, I get "NameError: uninitialized constant TzTime from (irb):1" as a response. I''m running rails on Locomotive on OSX if that makes any difference. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Here are the gems I have installed that might be related: tzinfo (0.3.5) Daylight-savings aware timezone library --Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Graff wrote:> Here are the gems I have installed that might be related: > > tzinfo (0.3.5) > Daylight-savings aware timezone library > > --MichaelAh, that was it. I even though I was able to install plugins from the gem, my app somehow did not have access to the gem. Thanks so much for helping me diagnose this issue Michael :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---