开发者

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?


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜