> To prevent this I think it may be a good idea to define > to_yaml_properties on ActiveRecord::Base and reject instance variables > which are association proxies. This could naively be archived by this: > > def to_yaml_properties > instance_variables.reject { |i| instance_variable_get > (i).respond_to?(:proxy_owner) }.sort > end
My gut feeling is that given that we don't override yaml conversion at all, we shouldn't attempt to address this behaviour. Either we should add a nice method ala to_xml and to_json that accept :only and :except and friends, or we should leave this for the user to deal with. The only place where I'm using .to_yaml in an application is with my own implementation, and perhaps people are relying on the current behaviour to include associations? Seems unlikely but... who knows. -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---