Last active
August 29, 2015 14:04
-
-
Save shirashin/64bd86c4d895ecc48c95 to your computer and use it in GitHub Desktop.
Deviseで認証失敗時にrootに遷移するようにする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # lib/custom_failure.rb[new] | |
| class CustomFailure < Devise::FailureApp | |
| def redirect_url | |
| root_url # 遷移先 | |
| end | |
| def respon | |
| if http_auth? | |
| http_auth | |
| else | |
| redirect | |
| end | |
| end | |
| end | |
| # config\application.rb[add] | |
| config.autoload_paths += %W(#{config.root}/lib) | |
| # config/initializers/devise.rb[add] | |
| config.warden do |manager| | |
| manager.failure_app = CustomFailure | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment