Rails 4: Force SSL Protocol

In config/routes.rb:

Rails.application.routes.draw do  
  resources :sessions, :constraints => { :protocol => "https" }
end  

or

Rails.application.routes.draw do  
  scope :constraints => { :protocol => "https" } do 
    # All your SSL routes.
  end
end