Reputation: 497
Here is the rake routes output for one of the urls
bug_info /bugs/:pr/:scope/info(.:format) {:controller=>"bugs", :action=>"info"}
Inside the erb view if i call bug_info_path(:pr=>1,:scope=>2), the view gives me an error saying
No route matches {:scope=>"2", :action=>"info", :controller=>"bugs", :pr=>"1"}
What am I doing wrong here
match 'bugs/:pr/:scope/info' => 'bugs#info', :as=>:bug_info
Upvotes: 1
Views: 3961
Reputation: 11425
Very weird. I tested by generating a new rails app and populated with your stuff and it seems to work fine. Here is what I got. (This is with Rails 3.0.7).
config/route.rb
Railstest::Application.routes.draw do
match 'test' => 'bugs#test', :as=>:bug_test
match 'bugs/:pr/:scope/info' => 'bugs#info', :as=>:bug_info
end
app/controllers/bugs_controller.rb
class BugsController < ApplicationController
def test
end
def info
end
end
app/views/bugs/test.erb
<%= bug_info_path(:pr=>1,:scope=>2) %>
app/views/bugs/info.erb
<%= params %>
When I browse to /test
I get this:
/bugs/1/2/info
When I browse to /bugs/1/2/info
{"controller"=>"bugs", "action"=>"info", "pr"=>"1", "scope"=>"2"}
Maybe you could try with a minimal rails app too and then add things until i breaks.
Upvotes: 1