I have a model ‘site’ defined in a sub-folder ‘cms’
class Cms::Site < ActiveRecord::Base

the model is loaded correctly , checked in console:
config.autoload_paths += Dir["#{config.root}/app/models/**/"]


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 ?

class Backoffice::Cms::SitesController < ApplicationController
def index
@sites = Cms::Site.all

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

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