1

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?

2
  • You have resourceful routing setup for your instructors controller, but I don't see anything for availability? Commented May 9, 2013 at 19:20
  • Was an error in my posting...updated Commented May 9, 2013 at 19:39

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.