title: How to auto login in rails-on-ruby
body: <p>I use devise(ruby-on-rails) for authentication, using before_filter:authenticate_user! to require user login. Now I want to skip the login operation when on Rails.env:dev while still need authentication on Rails.env:prd.
  I wonder if I can auto login with a specific user(like admin) on code when the projected launched on env:dev.</p>
  
  <pre><code>class QueryController &lt; ActionController::Base
      layout "query"
      before_filter :auto_login
      before_filter :authenticate_user!, :except =&gt;
      [
          :show,
          :query
      ]
  
      def auto_login
          if Rails.env == 'dev'
              current_user = User.find_by(login: 'admin')
          end
      end
  </code></pre>
  
  <p>I wonder how authenticate_user implements to do the login action. I try to login with a user but failed.</p>