Monday, August 9, 2010

[Rails] Re: Creation of XML with objects

On Aug 9, 11:15 am, Mike Disuza <li...@ruby-forum.com> wrote:
> Hi,
> I am trying to get the response in xml format.
> For that I have written following code
>
>  def user_details
>     @user=User.find(params[:id])
>     @compa...@user.company
>     respond_to do |format|
>       format.xml {render :xml=> @user.to_xml(:include => @company)}

you should be giving the name of the association - not the actual
associated object

Fred

>     end
>   end
>
> I am getting following error:-
> "undefined method `macro' for nil:NilClass"
>
> Can anyone tell, what is wrong with the code?
>
> Thanks,
> Mike
> --
> Posted viahttp://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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate