diff options
author | Robin Dupret <robin.dupret@gmail.com> | 2014-01-01 06:31:05 -0800 |
---|---|---|
committer | Robin Dupret <robin.dupret@gmail.com> | 2014-01-01 06:31:05 -0800 |
commit | 224d3a69accb29f25bb46d132b8f591f25026559 (patch) | |
tree | 5a5803a6ca8cd25fa65737beb3cde7242c66872a /guides/source | |
parent | 97ddfb48dbab8d9410e473f3f6e7e2d189b97b4f (diff) | |
parent | aa22ab8ce1629e760034f46812dcde160d9391b5 (diff) | |
download | rails-224d3a69accb29f25bb46d132b8f591f25026559.tar.gz rails-224d3a69accb29f25bb46d132b8f591f25026559.tar.bz2 rails-224d3a69accb29f25bb46d132b8f591f25026559.zip |
Merge pull request #13559 from JuanitoFatas/action-controller
[ci skip] Add missing flash message in block filter example.
Diffstat (limited to 'guides/source')
-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 |