In looking at the to_xml method and its behavior on associations, currently it
includes the attributes from the associations into the same hash that represents
that AR instance being serialized.
Wouldn't it be better to have to_xml call to_xml on the association's AR
instances?
I would like to override a particular model's to_xml and would like the model
that has a has_many relationship to it use the overriden to_xml, but currently
that doesn't work.
Where I need this is in exposing via a REST style interface a key/value property
model that is implemented in the table using separate date, numeric, boolean and
string types for fast indexing. I want to hide this implementation detail from
the REST client and only want to expose a single value() method to the to_xml.
This works using to_xml(:method => :value, :only => []) in the model itself, but
then the other models that have associations with this model need to know that
also, which seems like a DRY violation.
If people like this idea, I'll code up a patch for it.
Regards,
Blair
--
Blair Zajac, Ph.D.
<[EMAIL PROTECTED]>
Subversion training, consulting and support
http://www.orcaware.com/svn/
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core