Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 1424

Show
Ignore:
Timestamp:
06/15/05 13:20:17 (3 years ago)
Author:
minam
Message:

render(:template) applies a layout by default. render("foo/bar") works with a layout again.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r1422 r1424  
    11*SVN* 
    22 
     3* render("foo/bar") works with a layout again  
     4 
    35* Fixed double-singularization on scaffolded pagination call (Address would be turned into Addres) #1216, #1404 [nilsga] 
    46 
     
    2527* Make sure the benchmarking render method always returns the output of the render. 
    2628 
    27 * render(:action) and render() are the only two calls that default to using a layout. All other render calls assume :layout => false. This also fixes send_file, which was applying a layout if one existed for the current action. 
     29* render(:action), render(:template) and render() are the only three calls that default to using a layout. All other render calls assume :layout => false. This also fixes send_file, which was applying a layout if one existed for the current action. 
    2830 
    2931* verify with :redirect_to won't redirect if a redirect or render has already been performed #1350 
  • trunk/actionpack/lib/action_controller/layout.rb

    r1378 r1424  
    220220    private 
    221221      def render_with_a_layout_options(options) 
    222         return options unless options.is_a?(Hash) 
    223         if options.values_at(:text, :file, :template, :inline, :partial, :nothing).compact.empty? 
     222        return { :template => options } unless options.is_a?(Hash) 
     223        if options.values_at(:text, :file, :inline, :partial, :nothing).compact.empty? 
    224224          options 
    225225        else 
  • trunk/actionpack/test/controller/new_render_test.rb

    r1378 r1424  
    9393  def accessing_params_in_template_with_layout 
    9494    render :inline =>  "Hello: <%= params[:name] %>", :layout => nil 
     95  end 
     96 
     97  def render_with_explicit_template 
     98    render "test/hello_world" 
    9599  end 
    96100 
     
    104108             "partial_only", "partial_only_with_layout", 
    105109             "accessing_params_in_template", 
    106              "accessing_params_in_template_with_layout" 
     110             "accessing_params_in_template_with_layout", 
     111             "render_with_explicit_template" 
    107112          "layouts/standard" 
    108113        when "builder_layout_test" 
     
    250255    assert_equal "<html>Hello: David</html>", @response.body 
    251256  end 
     257 
     258  def test_render_with_explicit_template 
     259    get :render_with_explicit_template 
     260    assert_response :success 
     261  end 
    252262end 
  • trunk/actionpack/test/controller/render_test.rb

    r1371 r1424  
    8989Fun::GamesController.template_root = File.dirname(__FILE__) + "/../fixtures/" 
    9090 
    91 class TestLayoutController < ActionController::Base 
    92   layout "layouts/standard" 
    93    
    94   def hello_world 
    95   end 
    96    
    97   def hello_world_outside_layout 
    98   end 
    99  
    100   def rescue_action(e) 
    101     raise unless ActionController::MissingTemplate === e 
    102   end 
    103 end 
    104  
    10591class RenderTest < Test::Unit::TestCase 
    10692  def setup