Hi, I have 2 models: User and Article. I have this relationship: * User has many articles (and Article belongs to user) * User has and belongs to many articles (and Article habtm users) But this is tricky because of: current_user.articles ...this can return articles thanks to *has_many* and *has_and_belongs_to* relations. So there''s a collision. How can I ask articles thanks has_and_belongs_to explicitly. And thanks has_many only too? Thanks -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 31, 8:49 am, "David B." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, >> But this is tricky because of: current_user.articles ...this can return > articles thanks to *has_many* and *has_and_belongs_to* relations. So > there''s a collision. > > How can I ask articles thanks has_and_belongs_to explicitly. And thanks > has_many only too? >Call one of the relationships something else, eg has_many :something_articles, :class_name => "Article" Fred> Thanks > -- > Posted viahttp://www.ruby-forum.com/.-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On May 31, 8:49�am, "David B." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Call one of the relationships something else, eg > has_many :something_articles, :class_name => "Article" > > FredThank you Fred -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.