Ethan
Ethan

Reputation: 60089

What's the correct way to log a user out of a Rails application?

I'd like to provide a "log out" function in a Rails app. Should I do...

session.delete

or

reset_session

From reading the docs, both look like they could work. Does it matter? Or should I use something else?

Upvotes: 2

Views: 192

Answers (1)

James Mead
James Mead

Reputation: 3502

I'd use reset_session, because it's part of the Rails API; whereas CGI::Session#delete is effectively an implementation detail which might change.

Upvotes: 6

Related Questions