Reputation: 2022
I need to match different patterns on routes to different controller.
Example: to match http://localhost:4000/<_ANY_THING_>
to PageController@index
, I do:
get "/:page", PageController, :show
Now, I need to add another route that only match to following pattern:
http://localhost:4000/@<_ANY_THING_>
That should match to UserController@profile
How can I do that?
Upvotes: 2
Views: 299
Reputation: 84140
There is nothing different for a route containing an @
:
get "/@:user", UserController, :profile
Just be sure to put this above anything else that has the potential to match (such as the catch all route in your example.)
Upvotes: 3