hello, i have a problem with cloning objects. the cloning of the objects is not really a problem. i can do that like this: def ActiveRecord::Base.clone(country_id) cloneObj = self.find(:first, :conditions => "country_id = 1") newObj = self.new newObj.save newObj = cloneObj.dup newObj.country_id = country_id newObj.save end the problem is that i would like to generalize the cloning of the has_and_belongs_to_many relations, too. so instead of doing: cloneObj.collection.each do |foo| newObj.collection << foo end in each and every model that has collections i would rather do that on an abstract level, too. so i think my question is: is there a way to find out if the class has has_many_and_belongs_to_many relations? and if so is there a way to use that to assign the collections to the "cloned" objects as a general extension of ActiveRecord::Base, like the clone method above? thanks for looking into that :) kind regards, alexander --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---