a shoe has_many socks. socks belong shoes.
using socks controller want make comparison siblings same parent_id shoe.
sockscontroller def show @sock = sock.find(params[:id]) @shoe = shoe.find(@sock.shoe_id) @socks = @shoe.socks end
socks - show.html.erb
<% @socks.each |sock| %> <%= link_to sock.sock_name %> <% end %>
naturally i'm getting socks in show.html.erb, want exclude current sock @socks = @shoe.socks. there way this? i'm exploring where.not options now, have never tried before.
additionally there inherently wrong initial def show? think it's ok, feel i'm being redundant in calls, , might able simplify reduce queries.
if want exclude current sock in view, this.
<% @socks.each |sock| %> <% next if sock.id == @sock.id %> <%= link_to sock.sock_name %> <% end %>