Filtering deep associations in Rails' to_xml?

Maybe one way to do it would be to override your role to_xml method. It would look like the following (approximatively): in your Role model: def to_xml(options={}) if application. Id!

= 3 options:indent ||= 2 xml = options:builder ||= Builder::XmlMarkup. New(:indent => options:indent) xml. Instruct!

Unless options:skip_instruct xml. Role do # role_application is the application linked to you role.. role_application = applications. Select {|a| a.Id == 3} xml.

Application_id role_applications. Id xml.Name role_application. Name xml.

Application do xml.Name role_application. Name end end else # return nothing return "" end end end and you would call it like this: format. Xml { render :text => @person.

To_xml( :include => { :roles => {} } ) (look at the documentation at the end of this page ).

Maybe one way to do it would be to override your role to_xml method. It would look like the following (approximatively): in your Role model: def to_xml(options={}) if application. Id!

= 3 options:indent ||= 2 xml = options:builder ||= Builder::XmlMarkup. New(:indent => options:indent) xml. Instruct!

Unless options:skip_instruct xml. Role do # role_application is the application linked to you role.. role_application = applications. Select {|a| a.Id == 3} xml.

Application_id role_applications. Id xml.Name role_application. Name xml.

Application do xml.Name role_application. Name end end else # return nothing return "" end end end and you would call it like this: format. Xml { render :text => @person.

To_xml( :include => { :roles => {} } ) (look at the documentation at the end of this page).

Ruby (with Ruby on Rails Framework) language file for GeSHi. * This file is part of GeSHi. * (at your option) any later version.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions