Forum: Ruby on Rails require tzinfo on rails 1.2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Robbie S. (Guest)
on 2007-02-28 10:19
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:in `index'

Can someone please tell me how to "require" tzinfo so it can be used in
any of my controllers?
Frederick C. (Guest)
on 2007-03-01 17:54
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...)

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

Fred
Rick O. (Guest)
on 2007-03-01 17:56
(Received via mailing list)
> 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
Robbie S. (Guest)
on 2007-03-02 09:35
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.
This topic is locked and can not be replied to.