开发者

Put many arrays inside the XML

开发者 https://www.devze.com 2023-03-01 08:50 出处:网络
I\'m using def index @services = Service.all respond_to do |format| format.html # index.html.erb format.xml{ render :xml => @services }

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

精彩评论

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