Paul Leader
2012-Nov-12 10:09 UTC
Rails Guide:"For belongs_to associations, has_many inverse associations are ignored." not clear?
Perhaps I''m bing a bit thick and missing something obvious (possible), but I found the caveats listed in section 3.5 of the Associations Rails Guide<http://guides.rubyonrails.org/association_basics.html> badly worded and confusing. The section gives an example with a has_many <-> belongs_to relationship is setup with inverse associations on both side, but then states the caveat*"For belongs_to associations, has_many inverse associations are ignored." * Could someone actually explain what that means in concrete terms? The example and the caveat appear to be contradictory. If the caveat is correct then I''m not sure I understand how the example works. Paul -- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/X0zTnP1Dc4gJ. For more options, visit https://groups.google.com/groups/opt_out.
Greg Donald
2012-Nov-13 04:16 UTC
Re: Rails Guide:"For belongs_to associations, has_many inverse associations are ignored." not clear?
On Mon, Nov 12, 2012 at 4:09 AM, Paul Leader <paul-5e781V7GuxRzjhtm8Ag3mw@public.gmane.org> wrote:> Perhaps I''m bing a bit thick and missing something obvious (possible), but I > found the caveats listed in section 3.5 of the Associations Rails Guide > badly worded and confusing. > > The section gives an example with a has_many <-> belongs_to relationship is > setup with inverse associations on both side, but then states the caveat > "For belongs_to associations, has_many inverse associations are ignored." > > Could someone actually explain what that means in concrete terms? The > example and the caveat appear to be contradictory. If the caveat is correct > then I''m not sure I understand how the example works.I''ve never needed :inverse_of. Looks like academic masturbation to me. -- Greg Donald -- 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 https://groups.google.com/groups/opt_out.
Paul Leader
2012-Nov-13 09:24 UTC
Re: Rails Guide:"For belongs_to associations, has_many inverse associations are ignored." not clear?
It is useful in a small number of situations, mostly where you need to ensure that two different references to the same object actually refer to the same instance. I''ve only needed to use it twice, both times were where we have callbacks updating multiple related objects based on data held in each other. Anyway, if anyone else does understand what that caveat actually means I''d appreciate an explanation. On Tuesday, November 13, 2012 4:17:22 AM UTC, Greg Donald wrote:> > On Mon, Nov 12, 2012 at 4:09 AM, Paul Leader <pa...-5e781V7GuxRzjhtm8Ag3mw@public.gmane.org<javascript:>> > wrote: > > Perhaps I''m bing a bit thick and missing something obvious (possible), > but I > > found the caveats listed in section 3.5 of the Associations Rails Guide > > badly worded and confusing. > > > > The section gives an example with a has_many <-> belongs_to relationship > is > > setup with inverse associations on both side, but then states the caveat > > "For belongs_to associations, has_many inverse associations are > ignored." > > > > Could someone actually explain what that means in concrete terms? The > > example and the caveat appear to be contradictory. If the caveat is > correct > > then I''m not sure I understand how the example works. > > I''ve never needed :inverse_of. Looks like academic masturbation to me. > > > -- > Greg Donald >-- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/8IsIfAtQ6c8J. For more options, visit https://groups.google.com/groups/opt_out.
gamov
2013-Oct-09 08:05 UTC
Re: Rails Guide:"For belongs_to associations, has_many inverse associations are ignored." not clear?
I also don''t understand what they mean since the example seems to contradict it... On Tuesday, November 13, 2012 5:24:16 PM UTC+8, Paul Leader wrote:> > It is useful in a small number of situations, mostly where you need to > ensure that two different references to the same object actually refer to > the same instance. I''ve only needed to use it twice, both times were where > we have callbacks updating multiple related objects based on data held in > each other. > > Anyway, if anyone else does understand what that caveat actually means I''d > appreciate an explanation. > > On Tuesday, November 13, 2012 4:17:22 AM UTC, Greg Donald wrote: >> >> On Mon, Nov 12, 2012 at 4:09 AM, Paul Leader <pa...-5e781V7GuxRzjhtm8Ag3mw@public.gmane.org> >> wrote: >> > Perhaps I''m bing a bit thick and missing something obvious (possible), >> but I >> > found the caveats listed in section 3.5 of the Associations Rails Guide >> > badly worded and confusing. >> > >> > The section gives an example with a has_many <-> belongs_to >> relationship is >> > setup with inverse associations on both side, but then states the >> caveat >> > "For belongs_to associations, has_many inverse associations are >> ignored." >> > >> > Could someone actually explain what that means in concrete terms? The >> > example and the caveat appear to be contradictory. If the caveat is >> correct >> > then I''m not sure I understand how the example works. >> >> I''ve never needed :inverse_of. Looks like academic masturbation to me. >> >> >> -- >> Greg Donald >> >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c7974de4-f687-40f5-849d-c5d9ab416440%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Oct-09 08:42 UTC
Re: Rails Guide:"For belongs_to associations, has_many inverse associations are ignored." not clear?
On 9 October 2013 09:05, gamov <gamaudruz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I also don''t understand what they mean since the example seems to contradict > it...Exactly which bit of http://guides.rubyonrails.org/association_basics.html#bi-directional-associations seems to be a contradiction? Unless you explain /exactly/ what you do not understand it is difficult to help. Colin> > > On Tuesday, November 13, 2012 5:24:16 PM UTC+8, Paul Leader wrote: >> >> It is useful in a small number of situations, mostly where you need to >> ensure that two different references to the same object actually refer to >> the same instance. I''ve only needed to use it twice, both times were where >> we have callbacks updating multiple related objects based on data held in >> each other. >> >> Anyway, if anyone else does understand what that caveat actually means I''d >> appreciate an explanation. >> >> On Tuesday, November 13, 2012 4:17:22 AM UTC, Greg Donald wrote: >>> >>> On Mon, Nov 12, 2012 at 4:09 AM, Paul Leader <pa...-5e781V7GuxRzjhtm8Ag3mw@public.gmane.org> >>> wrote: >>> > Perhaps I''m bing a bit thick and missing something obvious (possible), >>> > but I >>> > found the caveats listed in section 3.5 of the Associations Rails Guide >>> > badly worded and confusing. >>> > >>> > The section gives an example with a has_many <-> belongs_to >>> > relationship is >>> > setup with inverse associations on both side, but then states the >>> > caveat >>> > "For belongs_to associations, has_many inverse associations are >>> > ignored." >>> > >>> > Could someone actually explain what that means in concrete terms? The >>> > example and the caveat appear to be contradictory. If the caveat is >>> > correct >>> > then I''m not sure I understand how the example works. >>> >>> I''ve never needed :inverse_of. Looks like academic masturbation to me. >>> >>> >>> -- >>> Greg Donald > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/c7974de4-f687-40f5-849d-c5d9ab416440%40googlegroups.com. > > For more options, visit https://groups.google.com/groups/opt_out.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvP0dNd%2BDWLdkUaGUJqgm0hWT4eCeSE58%3D3QStNyGPwOg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.