I am trying to display a list of users on a page based on an attribute of the current user. If the current user has its instance variable called :position as "High School" list all the users with the :position "College" (and vice versa). I know I do this in the controller with an if else statement, but I cant figure out what the query call should be. Right now I have:
if current_user.position= "High School"
@user = User.all
else
@user= User.all
As a template. However, I need to switch the @user= statements, but I cant figure out how to restrict it. Any help? Thanks!
<% @quizzes.each do |quiz| %>
<tr>
<td><h6><%= quiz.userName%></h6></td>
<td><h6><%= quiz.q1 %></h6></td>
<td><% for q in quiz.q2 %>
<% if q != nil %>
<h6><%= q %></h6>
<% end %>
<% end %>
<td><h6><%= quiz.q3 %></h6></td>
<td>X</td>
</tr>