This project is archived and is in readonly mode.
render :xml and render :nothing with layouts
Reported by Aaron Gibralter | January 16th, 2009 @ 08:35 AM | in 2.x
Would it make sense for this to work:
render :xml => @ar_model, :layout => true
# or
render :nothing => true, :layout => true
Currently, the workarounds are:
render :inline => @ar_model.to_xml, :layout => true
# or
render :text => '', :layout => true
Why not allow for :xml to take a layout since Rails supports builder layouts anyway? As for :nothing, it seems like head :ok covers the rendering of nothing but headers... render :nothing should be "nothing" for the action's template...
Thoughts?
Comments and changes to this ticket
-
Ryan Bigg April 10th, 2010 @ 10:55 AM
Given the lack of discussion this ticket I would suggest this is a wont-fix.
-
Ryan Bigg April 10th, 2010 @ 10:55 AM
- Assigned user set to Mikel Lindsaar
-
José Valim April 10th, 2010 @ 12:16 PM
- State changed from new to resolved
- Assigned user changed from Mikel Lindsaar to José Valim
Both were fixed in Rails 3. In fact, in Rails 3 render :text => "" is preferred then render :nothing => true.
About the xml case, it won't accept a layout due to exempt_from_layout config. If you remove it, it should work.
-
Aaron Gibralter April 12th, 2010 @ 10:55 PM
exempt_from_layout is not in Rails 3, right?
Also, will
render :xml => @user, :layout => 'default'
andrender :json => @user, :layout => 'default'
work in Rails 3? -
Aaron Gibralter April 12th, 2010 @ 10:56 PM
exempt_from_layout is not in Rails 3, right?
Also, will
render :xml => @user, :layout => 'default'
andrender :json => @user, :layout => 'default'
work in Rails 3? -
José Valim April 12th, 2010 @ 11:10 PM
In Rails 3.0, if you have a xml layout, it will be automatically picked.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>