a == current_user.c.b.a On Apr 16, 9:06 pm, David Zhu <[email protected]> wrote: > 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 %> > > <p>This post belongs to another user. Please navigate away > immediately.</p> > > <% 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? > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/rubyonrails-talk?hl=en.
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

