diff options
author | Juanito Fatas <katehuang0320@gmail.com> | 2014-01-01 21:49:40 +0800 |
---|---|---|
committer | Juanito Fatas <katehuang0320@gmail.com> | 2014-01-01 21:49:40 +0800 |
commit | aa22ab8ce1629e760034f46812dcde160d9391b5 (patch) | |
tree | 7e919eb82d6135b761bcc8955ad914d7143cc3ea /guides | |
parent | b64bac489c58ce1169941f77f4d633cb4eb87cd8 (diff) | |
download | rails-aa22ab8ce1629e760034f46812dcde160d9391b5.tar.gz rails-aa22ab8ce1629e760034f46812dcde160d9391b5.tar.bz2 rails-aa22ab8ce1629e760034f46812dcde160d9391b5.zip |
[ci skip] Add missing flash message in block filter example.
Also make all three examples consistent.
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/action_controller_overview.md | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 8ea3859475..a67eba8f7c 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -665,7 +665,10 @@ The first is to use a block directly with the *_action methods. The block receiv ```ruby class ApplicationController < ActionController::Base before_action do |controller| - redirect_to new_login_url unless controller.send(:logged_in?) + unless controller.send(:logged_in?) + flash[:error] = "You must be logged in to access this section" + redirect_to new_login_url + end end end ``` @@ -682,7 +685,7 @@ end class LoginFilter def self.filter(controller) unless controller.send(:logged_in?) - controller.flash[:error] = "You must be logged in" + controller.flash[:error] = "You must be logged in to access this section" controller.redirect_to controller.new_login_url end end |