當我做軌功能測試問題
get :inside, :format => :xml, :lat2 => "41", :lng2 => "-73.9", :lat1 => "40", :lng1 => "-74", :category => "girl", :order => "date"
與我的routes.rb包括:
get 'images/inside/:lat1/:lng1/:lat2/:lng2/:order/:category', :to => "images#inside"
我得到
ActionController::RoutingError: No route matches {:lng1=>"-74", :category=>"girl", :lat2=>"41", :format=>:xml, :lng2=>"-73.9", :order=>"date", :lat1=>"40", :action=>"inside", :controller=>"images"}
但是當我做
get :inside, :format => :xml, :lat2 => "41", :lng2 => "-73", :lat1 => "40", :lng1 => "-74", :category => "girl", :order => "date"
它的工作原理!
唯一的區別是lng2的十進制值。
注意,如果routes.rb中沒有參數,可以它的工作原理,但我需要那些
請注意您的參數,看起來您正在反轉類別和順序 – apneadiving 2011-01-10 22:40:25
btw您應該url_encode您的參數。 – apneadiving 2011-01-10 22:42:18