views:

47

answers:

1

I want something like this in my routes.rb. This isn't at all correct, but something like this:

match '/:scope/authenticate' => '%{:scope}_authentication#create'

So going to /users/authenticate would route to the create method in the users_authenticate controller.

What is the best way to do this in Rails 3?

+1  A: 

Not something I've done, but does this work?

resources :users_authenticate
resources :things_authenticate
resources :admins_authenticate
match "/:scope/authenticate" => redirect("%{scope}_authenticate/create")
Chris
not for me. I don't get an error, but this instead: You are being redirected.
Dex
Fair enough, like I say, I haven't tried it. I'll have a fiddle on Monday when I have my Rails dev environment to hand if you haven't had an answer first.
Chris
How about if you put a `/` at the start of the redirect string?
Chris
Weird, it works now on another app. You can also `do match "/:scope/authenticate", :to => redirect("%{scope}_authenticate/create")`
Dex