# Anyone using Restful\_Authentication or could tell me?

**URL:** <https://www.ruby-forum.com/t/anyone-using-restful-authentication-or-could-tell-me/69757>\
**Category:** Rails\
**Created:** [September 23, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/anyone-using-restful-authentication-or-could-tell-me/69757 "2006-09-23T22:25:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [September 23, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/anyone-using-restful-authentication-or-could-tell-me/69757/1 "2006-09-23T22:25:52Z")

</div>

I’m having a problem getting the logout to work correct.

The sessions controller is how one logs in and out:  
Here is the destroy action:

def destroy  
self.current\_user.forget\_me if logged\_in?  
cookies.delete :auth\_token  
reset\_session  
flash[:notice] = “You have been logged out.”  
redirect\_to(‘index/welcome’)  
end

Just to preface, on my home page if user is logged in it displays the  
user name. The cookies and sessions are working correctly. However  
I’ve tried to get the logouts 2 ways:  
One is by creating a link\_to ‘sessions/destroy’ This seems to do  
nothing , but return an error:  
Unknown action  
No action responded to show

The other way is that I just link to sessions which gives me an  
nil.login error for this view:  
\<%= current\_user.login %\>  
\<%= current\_user.created\_at.strftime(“%m/%d/%Y”) %\>

I’d expect it being REST , that I need the link to show something like  
/destroy;6

Any ideas would be appreciated.  
Stuart

–

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [September 23, 2006, 10:31pm UTC](https://www.ruby-forum.com/t/anyone-using-restful-authentication-or-could-tell-me/69757/2 "2006-09-23T22:31:54Z")

</div>

On 9/23/06, Dark A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> reset_session
> 
> ```
> 
> No action responded to show  
> Stuart  
> Hi Stuart,

I’m exploring this plugin, and rest myself at the moment. I’ve just  
played  
with the routes on this one to see if it works.

The following works if  
map.resources :sessions, :users  
is defined

\<%= link\_to “Logout”, session\_url, :method =\> :delete %\>

I was concerned initially that I would need to identify the session that  
it  
will destroy. Then I realised there is no model for the session to  
identify  
with an id.

Instead the sessions controller is just an interface to the session  
itself.  
In the destroy method, all actions taken are in relation to the current  
session only so nothing is actually being affected in the db.

A link to session\_url with the method :delete causes the routes to map  
this  
to the destroy method.

This is seriously taking some getting used to for me.

Cheers  
Daniel

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [September 24, 2006, 12:42am UTC](https://www.ruby-forum.com/t/anyone-using-restful-authentication-or-could-tell-me/69757/3 "2006-09-24T00:42:16Z")

</div>

Take a look on [http://restolog.googlecode.com/svn/trunk/](http://restolog.googlecode.com/svn/trunk/) - i’m using  
restful auth

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [September 24, 2006, 1:04am UTC](https://www.ruby-forum.com/t/anyone-using-restful-authentication-or-could-tell-me/69757/4 "2006-09-24T01:04:20Z")

</div>

On 9/23/06, Stoyan Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Take a look on [http://restolog.googlecode.com/svn/trunk/](http://restolog.googlecode.com/svn/trunk/) - i’m using  
> restful auth

I see rest\_auth as one of the plugins, is there added documentation in  
there from you ?

Stuart

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 18, 2006, 10:43am UTC](https://www.ruby-forum.com/t/anyone-using-restful-authentication-or-could-tell-me/69757/5 "2006-10-18T10:43:28Z")

</div>

On 9/23/06, Dark A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> So the routes are set up correctly as you stated above and have been.  
> However my main page is is the index / welcome (action)  
> And in the destroy method I configured the blank redirect\_to  
> redirect\_to(‘index/welcome’)
> 
> So I think it was just set to default, perhaps I should have left it  
> at that ? Gonna try it.
> 
> Stuart

And yes it works now. Who am I to go changing code :).  
Thanks for the help.

Stuart

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [September 24, 2006, 2:28am UTC](https://www.ruby-forum.com/t/anyone-using-restful-authentication-or-could-tell-me/69757/6 "2006-09-24T02:28:29Z")

</div>

On 9/23/06, Daniel N [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> will destroy. Then I realised there is no model for the session to identify
> 
> Cheers  
> Daniel

Thanks for the information Daniel. Running the link removes the token  
and session. However I’m getting this error  
Routing Error  
no route found to match “/welcome” with {:method=\>:get}

So the routes are set up correctly as you stated above and have been.  
However my main page is is the index / welcome (action)  
And in the destroy method I configured the blank redirect\_to  
redirect\_to(‘index/welcome’)

So I think it was just set to default, perhaps I should have left it  
at that ? Gonna try it.

Stuart
