Browse files

[ci skip] Add missing flash message in block filter example.

Also make all three examples consistent.
  • Loading branch information...
1 parent b64bac4 commit aa22ab8ce1629e760034f46812dcde160d9391b5 @JuanitoFatas JuanitoFatas committed Jan 1, 2014
Showing with 5 additions and 2 deletions.
  1. +5 −2 guides/source/action_controller_overview.md
View
7 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

0 comments on commit aa22ab8

Please sign in to comment.