0
Nitrous.io에서 Active Admin을 사용하여 레일 앱을 만들었으며 모두 해당 개발 환경에서 작동합니다. 나는 인증/권한 부여를 위해 고안/CanCanCan을 사용하고Heroku에 레일 앱이 작동하지 않음
내가 Heroku가로 밀어 시도 및 액세스 활동 관리, 나는 다음과 같은 오류 얻을 :
:Started GET "/admin" for 91.226.23.198 at 2014-09-06 21:15:49 +0000
Processing by Admin::ProductsController#index as HTML
NoMethodError (undefined method `include?' for nil:NilClass):
app/models/user.rb:8:in `role?'
app/models/ability.rb:6:in `initialize'
내 사용자 모델과 같이입니다
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
def role?(r)
role.include? r.to_s
end
end
Ability.rb 내가 잘못 뭐하는 거지
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
if user.role? :administrator
can :manage, :all
elsif user.role? :moderator
can :manage, Product
can :manage, User, :id => user.id
cannot :destroy, User
#can :read, ActiveAdmin::Page, :name => "Dashboard"
can :read, ActiveAdmin::Page, :name => "Contact Us"
can :read, ActiveAdmin::Page, :name => "About x"
can :read, ActiveAdmin::Page, :name => "FAQ"
#can :manage, [Page, Unit, Category, News]
else
can :read, Product
can :manage, User, :id => user.id
cannot :destroy, User
#can :read, ActiveAdmin::Page, :name => "Dashboard"
can :read, ActiveAdmin::Page, :name => "Contact Us"
can :read, ActiveAdmin::Page, :name => "About x"
can :read, ActiveAdmin::Page, :name => "FAQ"
end
end
end
?
heroku 서버를 여러 번 다시 부팅 해 보았습니다.
도움 주셔서 감사합니다.
건배!
ability.rb를 게시 할 수 있습니까? –
안녕하세요 @ andreydeineko가 추가되었습니다 – bnussey
대답을 보셨나요? 그게 도움이 되었습니까? –