Alright, I’ve been doing map.resources routing for a while now, so
whatever I’m missing must be something stupid and obvious… Anyone
care to help me out?
– routes.rb:
…
map.resources :algorithms, :collection => { :search => :post } do
|algorithm|
algorithm.resources :snippets
end
…
– snippets_controller.rb
class SnippetsController < ApplicationController
def show
# …
end
end
– algorithms_controller.rb
class AlgorithmsController < ApplicationController
…
redirect_to algorithm_snippet_url(@algorithm, @snippet) # <- no such
method
redirect_to snippet_url(@algorithm, @snippet) # <- no such method
…
end
Alright, I’ve been doing map.resources routing for a while now, so
whatever I’m missing must be something stupid and obvious… Anyone
care to help me out?
Call rake routes to see all the routes you have declared. That usually
makes it obvious what the problem is.
DHH wrote:
Alright, I’ve been doing map.resources routing for a while now, so
whatever I’m missing must be something stupid and obvious… Anyone
care to help me out?
Call rake routes to see all the routes you have declared. That usually
makes it obvious what the problem is.
Right here, in white on black:
algorithm_snippet
GET
/algorithms/:algorithm_id/snippets/:id
{:controller=>“snippets”, :action=>“show”}
so, given that … it’s most definitely
algorithm_snippet_url(@algorithm, @snippet) … right?
Right here, in white on black:
algorithm_snippet
GET
/algorithms/:algorithm_id/snippets/:id
{:controller=>“snippets”, :action=>“show”}
so, given that … it’s most definitely
algorithm_snippet_url(@algorithm, @snippet) … right?
Yes. Are you running on latest edge? I can’t remember how this worked
on 1.2.x.
DHH wrote:
Right here, in white on black:
algorithm_snippet
GET
/algorithms/:algorithm_id/snippets/:id
{:controller=>“snippets”, :action=>“show”}
so, given that … it’s most definitely
algorithm_snippet_url(@algorithm, @snippet) … right?
Yes. Are you running on latest edge? I can’t remember how this worked
on 1.2.x.
Bah, I just figured it out and it was a stupid mistake. My code was
outside a method scope and was therefore being evaluated at the static
class level.