Changeset 1086

Show
Ignore:
Timestamp:
12/13/07 00:02:22 (1 year ago)
Author:
e.@brainspl.at
Message:

don't raise if names local on a partial is nil. closes #358

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/view_context.rb

    r991 r1086  
    6969    # and delegate them back to the controller. 
    7070    def method_missing(sym, *args, &blk) 
    71       @_merb_partial_locals[sym] || @web_controller.send(sym, *args, &blk) 
     71      if @_merb_partial_locals.key?(sym) 
     72        @_merb_partial_locals[sym] 
     73      else 
     74        @web_controller.send(sym, *args, &blk) 
     75      end 
    7276    end 
    7377     
  • trunk/spec/fixtures/views/partials/_erubis.html.erb

    r795 r1086  
    1 <%= respond_to?(:yo) ? yo : "No Locals!" %> 
     1<%= respond_to?(:yo) && yo ? yo : "No Locals!" %> 
  • trunk/spec/merb/render_spec.rb

    r1078 r1086  
    2020    content = c.partial "partials/#{@engine}", :yo => "Locals!" 
    2121    content.clean.should == "Locals!" 
     22  end 
     23 
     24  it "should render a partial with nil locals" do 
     25    c = new_controller 
     26    content = c.partial "partials/#{@engine}", :yo => nil 
     27    content.clean.should == "No Locals!" 
    2228  end 
    2329