Rails 3 SSL 协议链接
我正在尝试创建一个指向需要 ssl 的页面的链接,并且路由已正确设置为要求其为 https,但我不知道如何让 link_to 正常运行。我尝试过这样写,但是当我单击链接时,它仍然尝试访问 http 页面,而不是像我期望的那样访问 https 页面。我做错了什么吗?
link_to "Schedule a Visit!", :controller => 'visits',
:action => 'new',
:protocol => "https"
作为参考,这是我的 paths.rb 中的适当部分:
scope :constraints => {:protocol => "https"} do
resources :visits, :only => [:new, :create]
end
I'm trying to create a link to a page that requires ssl, and the routes are properly set up to require it to be https, but I can't figure out how to get link_to to behave properly. I've tried writing it like this, but when I click on the link it still tries to go to an http page, not the https page like I'd expect. Am I doing something wrong?
link_to "Schedule a Visit!", :controller => 'visits',
:action => 'new',
:protocol => "https"
For reference, this is the appropriate part in my routes.rb:
scope :constraints => {:protocol => "https"} do
resources :visits, :only => [:new, :create]
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅:
Rails 3 SSL 弃用
See this:
Rails 3 SSL Deprecation