Created
January 12, 2012 16:43
-
-
Save jfgomez86/1601525 to your computer and use it in GitHub Desktop.
Force SSL
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
| class AccountsController < ApplicationController | |
| before_filter :force_ssl | |
| def new | |
| end | |
| def create | |
| end | |
| end |
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
| class ApplicationController < ActionController::Base | |
| private | |
| # Works with Rails 3.1 | |
| def force_ssl | |
| if !request.ssl? | |
| redirect_to :protocol => 'https' | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment