diff options
author | Xavier Noria <fxn@hashref.com> | 2010-11-15 19:45:46 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-11-15 19:45:46 +0100 |
commit | 91a6db90cf8b2c07af4cf64a9c587268106aadd5 (patch) | |
tree | dbc677fcc9d6a627f9b894bffddaf90d43a576c7 /railties/guides/source/action_controller_overview.textile | |
parent | 7c5c1a07c03ec03536636c26e09b80b29a59beed (diff) | |
parent | c2c2b8b96220b11eb3512b1eaaf7985c84f03d67 (diff) | |
download | rails-91a6db90cf8b2c07af4cf64a9c587268106aadd5.tar.gz rails-91a6db90cf8b2c07af4cf64a9c587268106aadd5.tar.bz2 rails-91a6db90cf8b2c07af4cf64a9c587268106aadd5.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'railties/guides/source/action_controller_overview.textile')
-rw-r--r-- | railties/guides/source/action_controller_overview.textile | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile index c02e9f1912..b39075f101 100644 --- a/railties/guides/source/action_controller_overview.textile +++ b/railties/guides/source/action_controller_overview.textile @@ -239,7 +239,7 @@ class LoginsController < ApplicationController # "Delete" a login, aka "log the user out" def destroy # Remove the user id from the session - session[:current_user_id] = nil + @_current_user = session[:current_user_id] = nil redirect_to root_url end end @@ -261,6 +261,13 @@ class LoginsController < ApplicationController end </ruby> +Note it is also possible to assign a flash message as part of the redirection. + +<ruby> +redirect_to root_url, :notice => "You have successfully logged out" +</ruby> + + The +destroy+ action redirects to the application's +root_url+, where the message will be displayed. Note that it's entirely up to the next action to decide what, if anything, it will do with what the previous action put in the flash. It's conventional to display eventual errors or notices from the flash in the application's layout: <ruby> |