Reputation: 3509
I am using Rails 3.2, Devise and Cancan for an application with 3 user categories: Companies, Customers and Admins.
My problem is that I get this:
undefined local variable or method `current_user' for #<HomeController:0xb4fd217c>
In HomeController I have:
class HomeController < ApplicationController
before_filter :authenticate_customer!
load_and_authorize_resource :class => false
def index
render 'index'
end
end
Also, in the view:
- content_for :title, 'Home'
= link_to('Logout', destroy_customer_session_path, :method => :delete)
I am not calling current_user anywhere in my code.
Any ideas?
Upvotes: 0
Views: 1838
Reputation: 3726
CanCan makes two assumptions about your application.
You can override both of these by defining the current_ability method in your ApplicationController.
https://github.com/ryanb/cancan/wiki/Changing-Defaults
Upvotes: 3