Load_missing_constant

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’)

should it not be related to the nested
namespace :backoffice :cms ? I’ll try to change it
to :backoffice :cms_admin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs