Getting Rails URL helpers to automatically output https urls

后端 未结 7 2128
再見小時候
再見小時候 2020-12-25 12:02

I am developing a site that mixes http and https a lot - whats the best/easiest way to make the links use the right protocol for the route - can it be specified in the route

7条回答
  •  我在风中等你
    2020-12-25 12:39

    For Rails 3.2 I used a combination of @apneadiving's answer. Adding the below code to my ApplicationController

    def default_url_options(options={})
      options.merge{ :protocol => "https" }
    end
    

提交回复
热议问题