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
In the controller you are referencing a Staff
class, but in your model you define a EposnowStaff
class. Try renaming EposnowStaff
to Staff
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.