3

What used to work with Rails 3.1.0 was:

class MyController < ApplicationController
...
    def myAction
      ...
      data = render_to_string( :template => "reports/report.xml.builder", :layout => false)
      ...
    end
end

With Rails 3.2 I am getting a deprecation warning. How do I render an arbitrary xml builder view with Rails 3.2?

2 Answers 2

3

Instead of

render(:template => "reports/report.xml.builder", :layout => false)

Rails 3.2 wants

render(:template => “reports/report”, :formats => [:xml], :handlers => :builder, :layout => false)
Sign up to request clarification or add additional context in comments.

Comments

1

In my case I've '_test.xm.builder' partail so I have to use render_to_string it work like this

render_to_string(partial: "/assignments/test", :formats => [:xml], :locals=> {:abc=>'xyz'})

this will cure :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.