'Shortcut' routes for sign_in, sign_up and sign_out

80 views
Skip to first unread message

Martin S.

unread,
Jul 8, 2010, 5:22:54 AM7/8/10
to Devise
Hi!

I wanted devise to use short routes for sign_in, sign_up and sign_out.
I found a few mentions in this group, but no solution. So after
reading some source, here's mine:

devise_for :user, :path => 'account', :skip =>
[:sessions, :registration] do
scope :controller => 'devise/sessions', :as => :user_session do
get :new, :path => 'signin'
post :create, :path => 'signin', :as => ""
get :destroy, :path => 'signout'
end
resource :registration, :only => [:edit, :update, :destroy], :as
=> :user_registration,
:path => 'account', :controller => 'devise/registrations'
scope :controller => 'devise/registrations', :as
=> :user_registration do
get :new, :path => 'signup', :as => "new"
post :create, :path => 'signup', :as => ""
end
end

This generates the following routes:

new_user_session GET /signin(.:format)
{:action=>"new", :controller=>"devise/sessions"}
user_session POST /signin(.:format)
{:action=>"create", :controller=>"devise/sessions"}
destroy_user_session GET /signout(.:format)
{:action=>"destroy", :controller=>"devise/sessions"}
PUT /account(.:format)
{:action=>"update", :controller=>"devise/registrations"}
DELETE /account(.:format)
{:action=>"destroy", :controller=>"devise/registrations"}
edit_user_registration GET /account/edit(.:format)
{:action=>"edit", :controller=>"devise/registrations"}
new_user_registration GET /signup(.:format)
{:action=>"new", :controller=>"devise/registrations"}
user_registration POST /signup(.:format)
{:action=>"create", :controller=>"devise/registrations"}
POST /account/password(.:format)
{:action=>"create", :controller=>"devise/passwords"}
new_user_password GET /account/password/new(.:format)
{:action=>"new", :controller=>"devise/passwords"}
user_password PUT /account/password(.:format)
{:action=>"update", :controller=>"devise/passwords"}
edit_user_password GET /account/password/edit(.:format)
{:action=>"edit", :controller=>"devise/passwords"}
POST /account/confirmation(.:format)
{:action=>"create", :controller=>"devise/confirmations"}
new_user_confirmation GET /account/confirmation/new(.:format)
{:action=>"new", :controller=>"devise/confirmations"}
user_confirmation GET /account/confirmation(.:format)
{:action=>"show", :controller=>"devise/confirmations"}

Cheers,
Martin

José Valim

unread,
Jul 8, 2010, 5:24:50 AM7/8/10
to plataforma...@googlegroups.com
You need Rails master and Devise master in order to achieve this.
--
José Valim

Director of Engineering - Plataforma Tecnologia
Know more about us: http://plataformatec.com.br/en/

José Valim

unread,
Jul 8, 2010, 5:26:01 AM7/8/10
to plataforma...@googlegroups.com
:)

Martin S.

unread,
Jul 8, 2010, 5:33:44 AM7/8/10
to Devise
Do you think this might be a useful addition for
http://wiki.github.com/plataformatec/devise/howto-change-routes-for-default-scope-to-login-logout?

On Jul 8, 11:26 am, José Valim <jose.va...@gmail.com> wrote:
> :)
>
>
>
>
>
> On Thu, Jul 8, 2010 at 11:24 AM, José Valim <jose.va...@gmail.com> wrote:
> > You need Rails master and Devise master in order to achieve this.
>

José Valim

unread,
Jul 8, 2010, 5:36:34 AM7/8/10
to plataforma...@googlegroups.com
Yes, please add a note remarking that both Devise 1.1.0 and Rails 3 RC were not released yet and should be used from their git master repositories.

Martin S.

unread,
Jul 8, 2010, 5:44:17 AM7/8/10
to Devise
Done.

PS.: Thanks for creating devise!

On Jul 8, 11:36 am, José Valim <jose.va...@gmail.com> wrote:
> Yes, please add a note remarking that both Devise 1.1.0 and Rails 3 RC were
> not released yet and should be used from their git master repositories.
>
> On Thu, Jul 8, 2010 at 11:33 AM, Martin S. <martin.schuer...@gmail.com>wrote:
>
>
>
>
>
> > Do you think this might be a useful addition for
>
> >http://wiki.github.com/plataformatec/devise/howto-change-routes-for-d...
> > ?

José Valim

unread,
Jul 8, 2010, 5:48:22 AM7/8/10
to plataforma...@googlegroups.com

Done.

Thanks!

PS.: Thanks for creating devise!

You are welcome! :D

Reply all
Reply to author
Forward
0 new messages