devise 的 current_user method 跟 cancan。。。。rolify。。加起来就 return error 了
undefined method `current_user' for #Class:0x007f6bb4545688
app/models/user.rb:20:in `has_role?' app/models/ability.rb:11:in `initialize' app/controllers/application_controller.rb:35:in `new' app/controllers/application_controller.rb:35:in `current_ability'
然后 user role。。
def has_role?(role) case role when :admin return true if User.current_user.admin? return false when :member return true else false end end
求大神们解救。。