Stan McFarland
2006-Feb-03 20:11 UTC
[Rails] newbie trouble with find method and dual many-to-many relationship
Hi, I''m trying to do something which I think is fairly simple, but I''m stuck on the syntax. Briefly, I have three classes: users, groups, and blog_entries. There''s a M2M relationship between users and groups, and a M2M relationship between groups and blog_entries. I''ve got my classes defined ok, but in my "list" method for the blog_entries I only want to list those blog_entries that belong to groups of which the current user is a member. Assuming that the current_user is contained in the @currentUser object, how can I write a graceful find command that will only return the records as stated above? Thanks in advance, Stan McFarland