title: How do I get the attributes of an object in ruby?
body: <p>I'm new to Ruby and Rails. I've been trying to get a view of all users to work and am not sure what I'm doing wrong.</p>
  
  <p>I have a view with:</p>
  
  <pre><code>&lt;% provide(:title, "View all Users") %&gt;
  
  &lt;h1&gt;Users#viewall&lt;/h1&gt;
  &lt;p&gt;Find me in app/views/users/viewall.html.erb&lt;/p&gt;
  
  &lt;% 
  @users = User.all 
  @users.each do |user|
    user.name
  end
  %&gt;
  </code></pre>
  
  <p>The output of this is a list of objects in the database, with all the object's data. When I want to target (for example) just the name, it doesn't work.</p>
  
  <pre><code>[#&lt;User id: 1, name: "user name", email: "mail@mail.com", created_at: "2016-08-03 15:40:41", updated_at: "2016-08-03 15:40:41", password_digest: "$2a$10$KmWWK86H/dj.HAp9zcHOUOCbph1rawIer41kyH4dIrV..."&gt;]
  </code></pre>
  
  <p>What am I missing here? I'm not even really sure what to google as I don't know what the loop is spitting out.</p>