현재 Cancan을 사용하고 있으며 사용자는 기본적으로 서로 다른 '역할'을 가지고 있습니다. 나는 사람들이 '소비자'사용자 계정을 등록 할 수 있기를 바랄 뿐이며 비즈니스 계정 관리자는이를 수행 할 것입니다.레일 NameError (초기화되지 않은 상수 등록) :
그래서 지금은
class Users::RegistrationsController < Devise::RegistrationsController
load_and_authorize_resource
end
및 설정/routes.rb 내 ability.rb
def initialize(user)
user ||= User.new
...
# You can only create accounts that are consumers
can :create, User do |user|
user.role? :consumer
end
과 내 컨트롤러/사용자/registrations_controller.rb이 있습니다
devise_for :users, :controllers => {
:registrations => "users/registrations"
}
등록 페이지를 방문하면 스택 추적 없음으로 "초기화되지 않은 상수 등록"이 표시됩니다. . 어떤 아이디어?
를 따르십시오인가? –
행운이 해결? – ZMorek