Require tzinfo on rails 1.2


#1

I’ve just upgraded rails to 1.2 and now everything breaks when accessing
pages that use tzinfo.

I get the following errors:

uninitialized constant FriendController::Timezone
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/dependencies.rb:477:in
const_missing' #{RAILS_ROOT}/app/controllers/friend_controller.rb:22:inindex’

Can someone please tell me how to “require” tzinfo so it can be used in
any of my controllers?


#2

Could this be something to do with this:

We’ve fixed a bug that allowed libraries from Ruby’s standard library to
be auto-loaded on reference. Before, if you merely reference the
Pathname constant, we’d autoload pathname.rb. No more, you’ll need to
manually require ‘pathname’ now.

(from
http://weblog.rubyonrails.org/2006/11/23/rails-1-2-release-candidate-1)

If so you’ll have to stick require ‘tzinfo’ at the top of files that use
it.

Fred


#3

thanks. to get it working I had to:
#at the top of config/environment.rb
require ‘tzinfo’

AND

#at the top of my controller
include TZInfo

Now if only I can get the search_generator working now…it simply
refuses to load the Search module. IF anyones got a solution or willing
to help I’d be happy to throw a few $$ at them for their time.


#4

Can someone please tell me how to “require” tzinfo so it can be used in
any of my controllers?

require ‘tzinfo’ in your config/environment.rb file.


Rick O.
http://weblog.techno-weenie.net
http://mephistoblog.com