This is how I am showing the records of orders:
<% @orders.uniq.each do |order| %>
<% @count += 1 %>
<tr class="even border_text">
<td width="30"><strong><%= @count %></strong></td>
<td width="180"><strong><%= order.first_name %> <%= order.last_name %></strong></td>
<td width="180"><strong>Rs.<%= order.amount %></strong></td>
<td width="180"><strong><%= order.status %></strong></td>
<td><strong><%= order.created_at %></strong></td>
<td width="70px" align="center"><%= link_to edit, edit_admins_order_path(order.id) %>
</tr>
<% end %>
And controller:
@orders = Order.joins(:user).joins(:order_statuses).select("orders.id,users.first_name,users.last_name,orders.amount,orders.description,orders.created_at,order_statuses.status, max(order_statuses.created_at)").group("orders.id,users.first_name,users.last_name,orders.amount,orders.description,orders.created_at,order_statuses.status").page(params[:page]).per_page(10)
Problem is it is showing duplicate values if the status is changed or updated. How do I show unique values by orders.id