开发者

Put many arrays inside the XML

I'm using

def index
  @services = Service.all

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @services }
  end
end

to render an XML with all the services.

What is the right syntax to add another a开发者_运维技巧rray to the xml?

I mean to add for example

@activities = Activity.all

Thanks!


You can use

format.xml {render :xml => {:services => @services, :activities => @activities}}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜