I have models within a module file and access them from my controller
with Module::Model syntax, but only get unitialized const errors. I even
tried require ‘mymodule’, etc, no avail. The Prg
Google has ZERO help on this, and I can’t believe more people haven’t
run into this issue. What’s the deal?
Frustrated,
John
Keep putting this at the top until it gets an answer
On Jan 28, 2006, at 6:38 PM, John wrote:
–
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
John-
Here is what you have to do if you are running 1.0.0. Add this line
in side the environment.rb file here:
Rails::Initializer.run do |config|
Add support to use models in modules for namespaces.
config.controller_paths << File.join(::RAILS_ROOT, ‘app’, ‘models’)
#…
end
Its a little weird becuase you use controller_paths but it will let
you use Admin::Page < AR::Base for your models to have them
namespaced inside of modules.
This is the same way that components are able to load their models
and stuff. There has been support recently added to use this by
default on edge rails but im not sure if its been checked into the
repo yet.
Cheers-
-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
[email protected]
509-577-7732
There has been support recently added to use this by
default on edge rails but im not sure if its been checked into the
repo yet.
http://dev.rubyonrails.org/changeset/3493
Added reusable reloading support through the inclusion of the
Relodable module that all subclasses of ActiveRecord?::Base,
ActiveRecord?::Observer, ActiveController?::Base, and
ActionMailer?::Base automatically gets [DHH]. Added auto-loading
support for classes in modules, so Conductor::Migration will look for
conductor/migration.rb and Conductor::Database::Settings will look for
conductor/database/settings.rb [Nicholas S.]. Refactored
extensions to module, class, and object in active support [DHH]
–
Rick O.
http://techno-weenie.net