title: In Rails 4, how can I get data out of a devise user within a controller?
body: <p>I have an off-the-shelf devise User class, and I have a method that gets a specific user and prints their email address the console</p>
  
  <pre><code>def print_email
    user = User.where('id'=&gt;params[:id])
    puts user.email
  end
  </code></pre>
  
  <p>However, this gives me an error</p>
  
  <pre><code>NoMethodError (undefined method `email' for #&lt;User::ActiveRecord_Relation:0x007ff288919808&gt;):
  </code></pre>
  
  <p>To be sure I was getting the right user, I added </p>
  
  <pre><code>puts user.to_json
  </code></pre>
  
  <p>This prints the expected json, so the correct User is stored in the user variable, but I simply cannot access the email attribute of the user directly.</p>
  
  <p>How can I do this?</p>