Skip to content

Instantly share code, notes, and snippets.

@vmu9999
Created January 1, 2011 22:56
Show Gist options
  • Save vmu9999/762076 to your computer and use it in GitHub Desktop.
Save vmu9999/762076 to your computer and use it in GitHub Desktop.
RoR question
###Rails console
>> @users = User.all
=> [#<User id: 1, name: "Jordan Staub", email: "js648@drexel.edu", created_at: "2010-12-23 08:13:33", updated_at: "2010-12-23 08:13:33", encrypted_password: "834d11c57684c5c6093317dfee9e5a5f46ce3d39552a2062df6...", salt: "3d105e687dd215bba43d622fc016a57e8e79fddf59372c4251a...">, #<User id: 2, name: "Moondancer", email: "dmstaub@aol.com", created_at: "2011-01-01 03:06:44", updated_at: "2011-01-01 03:06:44", encrypted_password: "d0c9a730bb33c2edad49b93c310545b3b21790580485a3501a1...", salt: "fa6b409e1e2caabae401df83c9e89e9c337ffcc5aef57c34e60...">]
### the User index view
<% @users.each do |u| %>
<tr>
<td><%= u.name %></td>
<td><%= u.email %></td>
<td><%= link_to 'Show', u %></td>
<td><%= link_to 'Edit', edit_post_path(u) %></td>
<td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
How is rails able to parse the array to determine each user?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment