To_xml ignore fields

Hi!

I’d like to know how to (most easily) ignore some elements from produced
XML …

for example: @people.to_xml produces:

2 bob carson street ...

How can I not produce the “ID” field for example?

Thank you!

On Dec 12, 2007 4:22 PM, D. Krmpotic [email protected]
wrote:

bob

@people.to_xml(:except => [:id])

http://api.rubyonrails.org/classes/ActiveRecord/Serialization.html#M001113

Jason

Great! I was guessing it’s :ignore…

the problem is that when I start gem_server, I don’t see the RDOC for
rails… (the directory is empty)… I tried “gem rdoc rails”… it prbably
executes, but it doesn’t do nothing… so I refused to read the docs
until I have it set u locally… :slight_smile: it would be great if anyone could
give me instruction on how to install the rails docs… (most of the
other gems have RDOC link enabled, but no rails)…

byr and thank you!

Jason R. wrote:

On Dec 12, 2007 4:22 PM, D. Krmpotic [email protected]
wrote:

bob

@people.to_xml(:except => [:id])

http://api.rubyonrails.org/classes/ActiveRecord/Serialization.html#M001113

Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs