开发者

How do I set up a route in rails?

In my routes.rb I have this:

 map.namespace :admin do |admin|
       admin.resources :galleries do |galleries|
          galleries.resources :gallery_images, :as=>'images'
       end
 end

rake routes shows the route created like this:

 admin_gallery GET    /admin/galleries/:id

and when I go to this url in my browser:

http://192.168.2.2:3000/admin/galleries/11

I get this error:

开发者_运维知识库Unknown action
No action responded to 11

But I would have expected it to use the show action/view, what am I doing wrong?


Routes higher up in the file can interfere with this, and did. Tim Snowhite's comment was correct.


Remove the trailing slash and it should work for you

http://192.168.2.2:3000/admin/galleries/11
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜