Hello,

if you remove the :include => :company only the  company_id will be
serialized.

The following code should work as you expect : render :xml => @user

Mickael

On 9 August 2010 13:00, Mike Disuza <li...@ruby-forum.com> wrote:

> Hi Fred,
> How can I create user defined xml structure?
>
> My previous code gives me xml like:
> <user>
> <name>Mike></name>
> <email>m...@yahoo.com</email>
> <company>
>   <id>2</id>
>   <name>ABC</name>
> </company>
> </user>
>
> I need to create a XML like this:-
>
> <user>
>    <name>Mike</name>
>    <email>m...@yahoo.com</email>
>    <company_id>2</company_id>
> </user>
>
>
> Any help appreciated.
>
> Thanks,
> Mike
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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 rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to