title: Devise "current_user" method in CanCan ability results with "undefined method"  error
body: <p>I'm trying to use Devise authorisation with CanCan roles in my rails3+mongoid app.
  Now I have to limit users access to edit the events, so only their author could do this. Author of the event is determined by that line:</p>
  
  <pre><code>    &lt;%= f.hidden_field (:author, :value =&gt;current_user.email) %&gt;
  </code></pre>
  
  <p>So, now in CanCan's Ability file i'm trying to use this code:</p>
  
  <pre><code>  class Ability  
    include CanCan::Ability 
  
    def initialize(user)  
      user ||= User.new    
      if user.role? :admin  
        can :manage, :all  
      else 
          can :read, :all  
        end
        if
          user.role?(:normal)
          can :create, Event  
          can :update, Event do |event|  
            event.try(:author) == current_user.email
        end 
          can :create, Comment  
          can :update, Comment do |comment|  
          comment.try(:author) == current_user.email 
        end 
      end 
    end
  </code></pre>
  
  <p>end</p>
  
  <p>But this results me with this error:</p>
  
  <blockquote>
    <p>undefined local variable or method `current_user' for #</p>
  </blockquote>
  
  <p>Then i've tried to change </p>
  
  <pre><code>can :update, Event do |event|  
            event.try(:author) == current_user.email
  </code></pre>
  
  <p>to</p>
  
  <pre><code>event.try(:author) == Devise.current_user.email
  </code></pre>
  
  <p>but that results with this error</p>
  
  <blockquote>
    <p>undefined method `current_user' for Devise:Module</p>
  </blockquote>
  
  <p>So, what should I do and how can I call for `current_user' method from ability.rb? Thank you in advance for any tips. </p>