<% for user in @users %> <tr> <td><%=h user.name %></td> <td><%=h user.age %></td> </tr> <%end%>
check it out On Thu, Feb 25, 2010 at 11:52 AM, Xavier Noria <f...@hashref.com> wrote: > On Thu, Feb 25, 2010 at 7:18 AM, Tony Augustine <li...@ruby-forum.com> > wrote: > > > i changed but now its showing this error > > > > > > > > > > Showing app/views/users/index.html.erb where line #13 raised: > > > > You have a nil object when you didn't expect it! > > You might have expected an instance of Array. > > The error occurred while evaluating nil.each > > > > Extracted source (around line #13): > > > > 10: <th>Hobby</th> > > 11: </tr> > > 12: > > 13: <% @user.each do |user| %> > > Note you put the collection in @users, plural. The variable @user is > unset and thus nil, hence the error. You need to replace @user with > @users in the view. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- Thanks: Rajeev sharma -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.