Hello, I am hoping somwone can help with this....
Basically I have a website and I want to display a list of users currently using the site, prior to someone logging in.
In a sense, it is a way for people to view a profile before logging in, and then they can choose whether or not to add them as a friend,
SO - I have a login page which contains a link to a partial:
<%= render :partial => "user/friendlist" %>
in the friendlist file I have the following:
<% @users.each do |user| %>
<%= link_to thumbnail_tag(user), profile_for(user) %> <%= link_to user.username, profile_for(user) %>
<% end %>
However, the login page cannot render with this code as it complains about a nil object: (see below)
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
What do I need to amend or add in oder for this to work?
Kind regards & thanks for reading