[Rails] Re: load_missing_constant
should it not be related to the nested
namespace :backoffice :cms ? I'll try to change it
to :backoffice :cms_admin
On 21 oct, 11:34, Erwin <yves_duf...@mac.com> wrote:
> I have a model 'site' defined in a sub-folder 'cms'
> class Cms::Site < ActiveRecord::Base
> .....
>
> the model is loaded correctly , checked in console:
> application.rb
> config.autoload_paths += Dir["#{config.root}/app/models/**/"]
>
> console
>
> >Cms::Site.all => []
>
> Now trying to access this model from a sites_controller ( in
> backoffice/cms subfolder, action: index ) I get the
> load_missing_constant error, aslking for the model to define Site and
> not Cms::Site... where am I wrong ? or did I missed any initializing
> parameter ?
>
> backoffice/cms/sites_controller.rb
> class Backoffice::Cms::SitesController < ApplicationController
> def index
> @sites = Cms::Site.all
> end
>
> LoadError in Backoffice::Cms::SitesController#index
> Expected /Users/..../app/models/cms/site.rb to define Site
> (activesupport (3.2.8) lib/active_support/dependencies.rb:503:in
> `load_missing_constant')
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home