1
votes

I have a rails model located at app/models/scheduling/availability.rb which looks like:

class Scheduling::Availability < ActiveRecord::Base
end

I have a Rails controller located at *app/controllers/admin/scheduling/availabilities_controller.rb* which looks like:

class Admin::Scheduling::AvailabilitiesController < ApplicationController
  def index
    @availabilities = Scheduling::Availability.all
  end
end

My routes look like:

namespace :admin do
  namespace :scheduling do
    resources :availabilities
  end
end

When trying to load the url: /admin/scheduling/availabilities I get the error:

uninitialized constant Admin::Scheduling::AvailabilitiesController::Scheduling

I have a feeling this is because Rails is confusing the Scheduling module/namespaces.

What am I doing wrong?

1
You have resourceful routing setup for your instructors controller, but I don't see anything for availability? - Noz
Was an error in my posting...updated - Oved D

1 Answers

1
votes

Found my answer in another answer.

Need to preface my module with ::

class Admin::Scheduling::AvailabilitiesController < ApplicationController
  def index
    @availabilities = ::Scheduling::Availability.all
  end
end