title: How get Devise's current_user method in Rails Engine
body: <p>I have a Rails application that's using the Devise gem, and I'm creating a Rails Engine to mount in this app.</p>
  
  <pre><code>mount Comments::Engine =&gt; '/talk', :as =&gt; 'comments'
  </code></pre>
  
  <p>Within the Engine, I want to get the <code>current_user</code> instance from main application. </p>
  
  <p>In <strong>{main_app}/initializers/comments.rb</strong></p>
  
  <pre><code>Comments.user_class = "User"
  Comments.current_user = "current_user" #current_user is Devise method(works fine in app)
  </code></pre>
  
  <p>In <strong>{engine}/lib/comments.rb</strong></p>
  
  <pre><code>require "comments/engine"
  
  module Comments
    mattr_accessor :user_class, :current_user
  
    def self.user_class
      @@user_class.constantize
    end
  
    def self.current_user
      send(@@current_user)
    end
  end
  </code></pre>
  
  <p>When I call <code>Comments.current_user</code>, I get the error "wrong constant name current_user". </p>
  
  <p>What am I doing wrong? </p>