I'd appreciate any pointers into what may be going wrong:
# Controller
class UsersController < ApplicationController
def index
@users = User.all
end
# View
<table>
<tr>
<th>Name</th>
<th>UID</th>
<th></th>
<th></th>
<th></th>
</tr>
<% for user in @users %>
<tr>
<td> <%= user.name %> </td>
<td> <%= user.uid %> </td>
</tr>
<% end %>
</table>
# Model - generated using: generate model :name :uid
class User < ActiveRecord::Base
attr_accessible :name, :uid
end
That's what I get for "www.myWebAdress.com/users
"
Name UID
Why is the users list missing? Rails console shows three users.
Here is the source file of :www.myWebAdress.com/user generated by "show source"
<!DOCTYPE html>
<html>
<head>
</head>
<body >
</br>
</br>
<div class="container">
</br>
</br>
<div class="content" align="center">
</br>
</br>
</br>
</br>
<table>
<tr>
<th>Name</th>
<th>UID</th>
<th></th>
<th></th>
<th></th>
</tr>
</table>
</div>
</div>
<footer>
</footer>
</body>
</html>
Not sure if this is the cause, but can you try replacing
<% for user in @users %>
with
<% @users.each do |user| %>