Hello,
i have “a” has many “b”, “b” has many “c”, and “c” has many “d”
Now… “d” is a user model, and I have a current_user helper method
defined.
If i navigate to an “a” show page, how can I make sure that my
current_user (“d”) is part of that “a”? meaning how can i make sure
that current_user belongs to “a”? Because there is the b, and c in
between the “d” and “a”, how can I check to see if my current_user
(“d”) belongs to “a”?
And I being clear? thanks
P.S.
heres an example of what I want if there is only one level of
associations–
<% if !current_user == @post.user %>
This post belongs to another user. Please navigate away immediately.
<% else %>
The content of edit.html.erb
<% end %>
but that only compares the user, with the model that is up one level.
(In this case post)
How can i check to see if current_user is part of a higher level?