Forum: Ruby on Rails accessing models from lib

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.
D53151d3fb2de557729740292239d270?d=identicon&s=25 Thomas Kwan (thomask)
on 2006-03-27 02:33
Anyone tried to access the model class from a module in the lib
directory?
How should the require line look like?

I have class called A::Folder in app/models/a/folder.rb, and I was
trying
to include it in app/lib/common.rb by adding

  require "a/folder"

But I am getting the following error:

NameError (uninitialized constant Folder):
    /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:195:in
`const_missing'
...
757f7bb36043794bdd007f07066f1aa0?d=identicon&s=25 Rob Greene (Guest)
on 2006-03-27 04:54
(Received via mailing list)
Did you try

   require "models/a/folder"

That's what I've been using for other pieces of my model.
-Rob
This topic is locked and can not be replied to.