views:

29

answers:

2

I have a few related questions. I am new to Rails 3 after taking a year-long break from Rails in general.

I am using Devise for authentication and I have a controller and model called 'User'.

So, I can use 'localhost:3000/users/sign_out' to log the user out. I want to put a link at the top right that says 'logout' so when they click on it they get sent to 'users/sign_out'

How do I make a route for this so that I can say:

<%= link_to "Logout", logout_path %>

Also, I want to refer to registered users as members. Can I create a route to cloak this so that 'localhost/members' gets mapped to the 'users' controller? Further, so that '/members/1/edit' is mapped to 'users/1/edit'?

Thanks in advance.

+1  A: 
resources :members, :as => 'users'

the second question: now you can visit localhost/members, but actually it deal with UsersController.

ilstar
Thank you. I figured it was easy. :)
NJ
+1  A: 

Regarding your first question - I believe that there is an example in wiki: http://github.com/plataformatec/devise/wiki/How-To:-Change-the-default-sign_in-and-sign_out-routes

Roman
Thanks, I did find that and I have it working.
NJ