CopyAndPaste

random programming notes

Rails Force SSL

Staring rails 3, we shall avoid using ssl_requirement GEM, as the GEM does not work very well on heroku. Sometimes the HTTPS page is redirected and the URL params are lost. To fix this, force using HTTPS in config/routes.rb as follow:

1
2
3
4
  resources :accounts,
            :constraints => { :protocol => 'https' } do 
  # ... 
  end 
You can also use scope.