views:

33

answers:

1

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-hello

I have a to_param in my Post model 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!

+4  A: 
map.resources :posts, :as => "is"

For the permalink part, see this question (but it looks like you've already got it right):

http://stackoverflow.com/questions/2268801/rails-routing-custom-routes-for-resources/2268831

Tomas Markauskas
Thank you, Tomas! Worked perfectly
Victor P