I set up restful authentication and user management without any gems in Rails 3.
However, I think it’s silly to need to go to “/sessions/new” instead of “/sign_in”.
I know you can alias an entire resource, so that instead of “/sessions”-and-friends my users could use “/squirrels”-and-friends, but that’s not what I’m trying to accomplish here. I want to alias one specific action.
I know this can kind of be accomplished with
resources :sessions, :path_names => { :new => "sign_in" }
but then the route ends up as “/sessions/sign_in” — and I don’t want the controller name in there at all for this action. I wish I could specify this with
resources :sessions, :path_names => { :new => "/sign_in" }
where the “/” tells rails that it is a complete path name. But that has the same effect as the first code fragment.
My last attempt was just to use the superficial
match "sign_in" => "sessions#new"
which allows someone to manually enter “/sign_in” in their URL bar, but links made with new_session_(path|url) still land users at the more awkward “/sessions/sign_in”.
1 Answer