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'
精彩评论