ActiveResource NameError in Overridden Devise class

84 Views Asked by At

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

1

There are 1 best solutions below

2
Puhlze On BEST ANSWER

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