Forum: Ruby on Rails Link_to_remote and SSL problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Michael S. (Guest)
on 2007-04-03 23:45
(Received via mailing list)
I'm having trouble with link_to_remote on an SSL page.

I have a form that includes multiple items (multiple instances of one
model). I use link_to_remote to an RJS function to allow the user to
delete items. The delete link, which is inside the partial that
displays an item, looks like this:

<%= link_to_remote 'Delete', :url => { :action =>
'delete_item', :index => index } %>

And it worked great -- until I switched the page to SSL. I'm using the
ssl_requirement plugin. The page itself works fine, but the delete
link no longer works. Firebug reports that this is because the
link_to_remote call goes to http:// not https:// and is therefore not
allowed by the security model.

So I changed the code to:

<%= link_to_remote 'Delete', :url => { :action =>
'delete_item', :index => index, :protocol => 'https://'  } %>

But it still generates a plain http request. I tried adding :only_path
=> false but that didn't do it either.

I'd really appreciate any pointers on this.

Thanks,

Michael

P.S. Curiously, there is a very similar 'add_item' link:

<%= link_to_remote "Add item", :url => { :action => 'add_item', :index
=> index } %>

And this works fine. Why would this one generating an https: request
and the other one not?
This topic is locked and can not be replied to.