Hi,
In your controller you can specify what you want to be included in the
xml and filter out the stuff you don't want to be there. For example:
render :xml => @survey_response.to_xml( :dasherize => false,
:include => {
:user =>
{:include =>
{:city =>
{:include =>
{:state => {}
}
}
}
},
:answers =>
{:include =>
{:question => {}, :choice => {}
}
}
}
)
that's part of controller i have for one of my apps where i feed back
to the xml the answers given by a user who filled a form. And i choose
to include the city/state information with the answers, whereas if i
do the following:
render :xml => @survey_response.to_xml( :dasherize => false,
:include => {
:user =>
{:include =>
{:city =>
{:include =>
{:state => {}
}
}
}
}
}
)
I would be just including the city/state info and leaving out the
answers. You could do something similar for your model.
I hope this is helpful
On Oct 9, 2:58 pm, Nicholas Wieland <[EMAIL PROTECTED]>
wrote:
> Hi *,
> I'm writing a Restful service that should map a pre-existing
> partially restful site.
> What I find confusing is how to display models in my views. I'm
> writing all XML in builder using the respond_to API, but everything I
> found on the net uses the to_xml method of model's instances, and
> that's not my case because I don't want to display every attribute of
> my models.
> Problem is that to_xml for example gives type informations for most
> (not all) attributes.
> Is there a place where this is documented ? How should I write my
> builder views ? Try a to_xml and rewrite ? Ouch ... :p
>
> TIA, much appreciated,
> ngw
>
> smime.p7s
> 3KViewDownload
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---