although i had this question before but did not get anything useful and am stuck. Ok my app is a simple ebay clone, where i had divided users into roles buyers and sellers with role id 1 and 2. When anyone sign up or login they are transferred to the index page of the app, Now i want buyers to see something different then sellers on the index page and for that I had tried the if and else method but nothing happened. Is am doing anything wrong? I there any other way to get on this.
My Index.html.erb file
<div class="col-md-12 text-right">
<% if role_id == 1 %>
<%= link_to "Add a new Product", new_product_path, class: "btn btn-success" %>
</div>
<% else %>
<div class="col-md-8">
<% @products.each do |productt| %>
<div class="product">
<h4><strong><font style="text-transform: capitalize;"><%= shipment.user.full_name%></strong></h4></font>
<h5><strong>DESCRIPTION: </strong><%= product.description %></h5>
<div class="thumbnail">
<td><%= image_tag product.image.url(:medium)%></td>
<div class="meta">
<%= link_to time_ago_in_words(product.created_at) + " ago" %>
<span class="admin">
| <%= link_to "Show Details", product %>
</span>
</div>
</div>
</div>
</div>
<% end %>
<% end %>
and
My seeds.rb
['buyers', 'sellers'].each do |role|
Role.where(name: role).first_or_create
end