Chiggins
Chiggins

Reputation: 8407

Rails Faux-Rename Controller

The title might be a little misleading, and I apologize for that. What I want to do is something like how Reddit renames their controller for their subreddits. They use the form /r/programming, instead of the longer /subreddit/programming. I know that they don't use Rails, but how would I go about doing that with Rails?

Thanks!

Upvotes: 1

Views: 122

Answers (1)

Mitch Dempsey
Mitch Dempsey

Reputation: 39939

You can just use a matcher in your routing for this.

In routes.rb

resources :subreddits, :path => "/r"

Further Reading: http://guides.rubyonrails.org/routing.html

Upvotes: 1

Related Questions