Mask the name of a controller, Rails
I have a controller posts: www.mydomain.com/posts/123-hello
Please bear in mind that the 123 is unique for each post but is not the correlative id (post.permalink)
I want to access the posts through addresses like:
www.mydomain.com/is/123-hello
not www.mydomain.com/posts/123-helloI have a to_param
in my Post m开发者_StackOverflowodel to construct the "123-hello", but when I use redirect_to @post
I end in www.mydomain.com/posts/123-hello
How can I do this? Thanks in advance!
map.resources :posts, :as => "is"
For the permalink part, see this question (but it looks like you've already got it right):
Rails routing - custom routes for Resources
精彩评论