Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

link_to with :protocol isn't working

I want to have a link use SSL. I'm using this code:

<%= link_to "Buy now!", line_items_path(:thing_id => @thing), :method => :post, :protocol => "https", :only_path => false %>

For some reason, the link is being generated with http:// instead of https://.

I'm using Rails 3.0.3.

like image 492
Tim Sullivan Avatar asked Dec 04 '10 21:12

Tim Sullivan


1 Answers

You must put the :protocol option inside the path helper:

<%= link_to "Buy now!", line_items_url(:thing_id => @thing, :protocol => "https"), :method => :post %>
like image 64
Ryan Bigg Avatar answered Oct 18 '22 19:10

Ryan Bigg