Changeset 885

Show
Ignore:
Timestamp:
11/06/07 17:04:23 (1 year ago)
Author:
iv..@gweezlebur.com
Message:

fix url(:foo, @foo)

Files:

Legend:

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

    r874 r885  
    6363      end 
    6464       
    65       url = if !(new_params.keys & [:controller, :action, :id]).empty? 
     65      url = if new_params.respond_to?(:keys) && 
     66        !(new_params.keys & [:controller, :action, :id]).empty? 
    6667          url_from_default_route(new_params) 
    6768        elsif route_name.nil? && !route.regexp? 
  • trunk/spec/merb/controller_spec.rb

    r874 r885  
    109109    url.should match(%r{/foo/bar?.*user\[order\]\[\]=name}) 
    110110  end 
     111   
     112  it "should handle an object as the second arg" do 
     113    c = new_url_controller(@resource_routes, :controller => "blogs", :action => "show") 
     114    blog = mock("blog") 
     115    blog.should_receive(:id).once.and_return(7) 
     116    url = c.url(:blog, blog) 
     117    url.should == "/blogs/7" 
     118  end 
    111119end