ruby-on-railsrubydeviseactiveresource

ActiveResource NameError in Overridden Devise class


I'm attempting to use an ActiveResource class (Staff) within an overridden Devise resource (User). The purpose at this time is simply to return a list of Staff for the registering user to select from at registration time.

controllers/user/registrations_controller.rb

def new
   @list = Staff.find()
   super
end

models/staff.rb

require 'active_resource'

class Staff < ActiveResource::Base
   self.site = "http://localhost/Staff/"
end

My gem file includes gem 'active_resource'

When the overridden new method gets called the following error is displayed;

NameError in User::RegistrationsController#new uninitialized constant User::RegistrationsController::Staff

Any ideas on how this can be overcome?

Thanks Mark


Solution

  • In the controller you are referencing a Staff class, but in your model you define a EposnowStaff class. Try renaming EposnowStaff to Staff.