Hi, I have a member class that has many application_partials through subdivisions. My models look like the following: class Member < Company ... has_many :subdivisions, :dependent => :destroy has_many :application_partials, :through => :subdivisions, :order => "subdivisions.position" .... end class Subdivision < ActiveRecord::Base belongs_to :member belongs_to :application_partial, :dependent => :destroy acts_as_list :scope => :member_id end class ApplicationPartial < ActiveRecord::Base has_many :subdivisions has_many :members, :through => :subdivisions end When I destroy a member, all of the application partials associated with the member should be destroyed as well. I have tried various methods, but can not find a way to accomplish this. Thanks for your help! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I think since your ApplicationPartial doesn''t belong_to the Subdivision, it isn''t a dependent... you might want to revisit how your model relationships are spec''ed. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the reply. Do you have any recommendations on how this associations should be done? What I am trying to accomplish is to have a member, that has and belongs to many ApplicationPartials but using the join table subdivisions (using has_many :through). Every example that I can find online does the relationships this way. Maybe the best was is to write a before destroy action to accomplish this? Thanks again! On Jun 5, 1:05 pm, Ar Chron <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I think since your ApplicationPartial doesn''t belong_to the Subdivision, > it isn''t a dependent... you might want to revisit how your model > relationships are spec''ed. > -- > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
The more I think about this, the more that it doesn''t make sense, and is over complicated for what I am trying to do. I am switching my association to a has_many. Thanks for your help! On Jun 5, 2:54 pm, Lundie <rlun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks for the reply. > > Do you have any recommendations on how this associations should be > done? What I am trying to accomplish is to have a member, that has > and belongs to many ApplicationPartials but using the join table > subdivisions (using has_many :through). Every example that I can find > online does the relationships this way. > > Maybe the best was is to write a before destroy action to accomplish > this? > > Thanks again! > > On Jun 5, 1:05 pm, Ar Chron <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > I think since your ApplicationPartial doesn''t belong_to the Subdivision, > > it isn''t a dependent... you might want to revisit how your model > > relationships are spec''ed. > > -- > > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
Quitter On Jun 5, 3:41 pm, Lundie <rlun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The more I think about this, the more that it doesn''t make sense, and > is over complicated for what I am trying to do. > > I am switching my association to a has_many. Thanks for your help! > > On Jun 5, 2:54 pm, Lundie <rlun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Thanks for the reply. > > > Do you have any recommendations on how this associations should be > > done? What I am trying to accomplish is to have a member, that has > > and belongs to many ApplicationPartials but using the join table > > subdivisions (using has_many :through). Every example that I can find > > online does the relationships this way. > > > Maybe the best was is to write a before destroy action to accomplish > > this? > > > Thanks again! > > > On Jun 5, 1:05 pm, Ar Chron <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > I think since your ApplicationPartial doesn''t belong_to the Subdivision, > > > it isn''t a dependent... you might want to revisit how your model > > > relationships are spec''ed. > > > -- > > > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---