Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 25th, 2012  |  syntax: None  |  size: 0.69 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Change protocol to https in all rails helpers
  2. ROUTES_PROTOCOL = (ENV["RAILS_ENV"] =~ /development/ ? 'http://' : 'https://')
  3.  
  4. scope :protocol => ROUTES_PROTOCOL, :path => "/app" do
  5.        
  6. YOURAPPNAME::Application.configure do
  7.  
  8.   # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  9.   config.force_ssl = true
  10. end
  11.        
  12. if !request.ssl?
  13.   "https://" + request.host + request.request_uri
  14. elsif request.ssl?
  15.   "http://" + request.host + request.request_uri
  16. end
  17.        
  18. config.action_mailer.default_url_options = {
  19.   :host => 'yourwebsite.com',
  20.   :protocol => 'https'
  21. }
  22.  
  23. # Makes it possible to use image_tag in mails
  24. config.action_mailer.asset_host = "https://yourwebsite.com"