I have a controller that I want to use to render xml.  The problem is
that I want the rendered XML to also contain the data from a model
attached through a has_many reference.

I figured out a way to do it by stuffing it all in a hash.  But I hope
there is a more elegant way as it is rather ugly.
He is what I have:

A model named Code which has the following line:
...
has_many :clients, :accessible => true
...

The controller for the Code model (named CodesController) has the
following:
...
def show
   hobo_show do |format|
      format.xml do
         @code = Code.find params[:id]
         render :xml => {:code => @code, :clients => @code.clients.find
(:all)}
      end
      format.html { }
   end
end
...

There is a better way to do this right?

Thanks,
-oillio
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" 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/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to