Croplio
Croplio

Reputation: 3593

about rails' routes, adding collection routes to restful resources won't generate named route helpers?


namespace :admin do
    resources :posts do
        collection do
            get 'whatever'
        end
    end
end

I was expect that will generate 'whatever_admin_posts_path' helper method, but it didn't.
It's there something wrong with my codes? Or a bug in rails?

Upvotes: 0

Views: 661

Answers (1)

Shadwell
Shadwell

Reputation: 34774

The namespace isn't typically added to the method that returns the route. So you probably have a route whatever_posts_path. The rake task rake routes is particularly useful in these cases. The first part of the display for each route is the name of the method you can use to access it (if available).

Upvotes: 1

Related Questions