开发者

Controller doesn't equal to model name in Rails

I've model called BlogPost and controller called BlogPostsController that has all basic CRUD methods for BlogPost.

I'm trying to understand how I can route users to have URL like /blog/post-name instead of /blog_posts/post-name and "di开发者_C百科sable" in general URL /blog_posts. Should I rename my controller or should I change routes (and how)?


Update your routes and add the :as option to your blog post resource route

map.resources :blog_posts, :as => 'blogs'
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜