Sharing a resource's schema through REST

Voila. Now the HTML response and the XML response refer to the same
object. The XML client gets the field names and types, and defaults
for the field values to boot. And we didn't even have to touch the
Rails core.

Another reason this is good is that default values for attributes (at
the DB level) will be included in the schema XML, which is definitely
desired.

I played with exactly this last night, and I think it *is* the better
solution, and of course far less work. The major problem is that this
won't include any associations, even if :include is passed as a param,
because all the associations are either an empty array or nil.
Possible solutions are to add an :include_associations
or :include_empty argument or something to to_xml, or to change
to_xml's default behavior to include associations in the XML
when :include'd, whether they're empty or not.

I'm starting to think that this may be unnecessary. Create/update
requests don't need to be sent that include associated data -- those
can be taken care of separately, with create/update requests to their
own controller. I'm not set on this, and maybe associations should be
included, but I think it's worth it to take the easy win now and get a
schema with all attributes. I'll make the patch to add these lines to
the scaffold_resource generator.

I'll make the patch to add these lines to the scaffold_resource generator.

Here's the ticket with patch:
http://dev.rubyonrails.org/ticket/8185