Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

render :xml and render :nothing with layouts

#1771

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?

Reported by Aaron Gibralter · January 16th, 2009 @ 08:35 AM

State: resolved
Milestone: 2.x
Assigned to: José Valim José Valim
Importance: none

Activity

  1. Ryan Bigg
    Ryan Bigg

    Given the lack of discussion this ticket I would suggest this is a wont-fix.

    April 10th, 2010 @ 10:55 AM

  2. Ryan Bigg
    Ryan Bigg
    • Assigned user set to Mikel Lindsaar

    April 10th, 2010 @ 10:55 AM

  3. José Valim
    José Valim
    • 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.

    April 10th, 2010 @ 12:16 PM

  4. Aaron Gibralter
    Aaron Gibralter

    exempt_from_layout is not in Rails 3, right?

    Also, will render :xml => @user, :layout => 'default' and render :json => @user, :layout => 'default' work in Rails 3?

    April 12th, 2010 @ 10:55 PM

  5. Aaron Gibralter
    Aaron Gibralter

    exempt_from_layout is not in Rails 3, right?

    Also, will render :xml => @user, :layout => 'default' and render :json => @user, :layout => 'default' work in Rails 3?

    April 12th, 2010 @ 10:56 PM

  6. José Valim
    José Valim

    In Rails 3.0, if you have a xml layout, it will be automatically picked.

    April 12th, 2010 @ 11:10 PM