nkryptic@gmail.com
2006-Nov-12 17:04 UTC
has_many :through extended with writer and clear methods
I hope this hasn''t been asked yet. I couldn''t find it if it was. I''ve extended the has_many through association to include a clear method as well as adding a mass assignment for the collection. I wanted to know if what I am doing is sane and/or if it is redundant because it is already being worked into rails edge. The full description and code is at http://www.nkryptic.com/2006/11/12/make-has_many-through-more-like-has_many If there is a better way to handle this, or if there is some reason that what I''m doing will cause other problems, please let me know. Otherwise, feel free to use it. Jacob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
nkryptic@gmail.com
2006-Nov-12 17:35 UTC
has_many :through extended with writer and clear methods
I hope this hasn''t been asked yet. I couldn''t find it if it was. I''ve extended the has_many through association to include a clear method as well as adding a mass assignment for the collection. I wanted to know if what I am doing is sane and/or if it is redundant because it is already being worked into rails edge. The full description and code is at http://www.nkryptic.com/2006/11/12/make-has_many-through-more-like-has_many If there is a better way to handle this, or if there is some reason that what I''m doing will cause other problems, please let me know. Otherwise, feel free to use it. Jacob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2006-Nov-21 01:17 UTC
Re: has_many :through extended with writer and clear methods
> I''ve extended the has_many through association to include a clear > method as well as adding a mass assignment for the collection.I dunno that I see the need for this. If the instances of the :through association don''t matter, just use has_and_belongs_to_many. If they do matter, then you should be constructing them yourself in code.> I wanted to know if what I am doing is sane and/or if it is redundant > because it is already being worked into rails edge. > > The full description and code is at > http://www.nkryptic.com/2006/11/12/make-has_many-through-more-like-has_many > > If there is a better way to handle this, or if there is some reason > that what I''m doing will cause other problems, please let me know. > Otherwise, feel free to use it. > > Jacob > > > > >-- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
jmckible@gmail.com
2006-Nov-23 16:02 UTC
Re: has_many :through extended with writer and clear methods
I stumbled across this same issue recently as well. I haven''t seen anything like it in edge. The only difficulty I foresee is associating objects if one hasn''t been saved to the database. I think a few other changes would be needed in other places to really take advantage of this. For example, say you have an edit form for Group and have a list of Users that are joined through Membership. if you deselect all Users, nothing will get passed through as a parameter to the update request. In that case, the update_attributes method should know that getting no Users back as a parameter means to remove all Users from the Group. Here is my write up of the problem http://blog.tuples.us/?p=46 Jordan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---