Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on rails 3: link_to :remote => true treats "remote" as a URL parameter

I'd like to know what the link_to syntax is supposed to be for making ajax requests (or other ideas on what might be going wrong here). Currently I have

<%= form_tag "save_sets", :remote => true, :name => "set_form" do %>

in a file and it works perfectly. However, in the very same file, all of

<%= link_to assignment.name, :action => :view_student_problem_set, :remote => true %>
<%= link_to assignment.name, :remote => true, :action => :view_student_problem_set %>
<%= link_to assignment.name, {:action => :view_student_problem_set, :remote => true} %>
<%= link_to assignment.name, {:remote => true, :action => :view_student_problem_set} %>
<%= link_to assignment.name, {:remote => true}, {:action => :view_student_problem_set} 
<%= link_to assignment.name, {:remote => true}, :action => :view_student_problem_set %>

just produce links with "?remote=true" instead of data-remote="true", and

<%= link_to assignment.name, :remote => true, {:action => :view_student_problem_set} %>

is apparently a syntax error.

Most of the combinations I have tried are from tutorials, forum posts, and documentation. I didn't think that collections of symbols had to be in a particular order, but I was just being thorough. In any event, my googling skills have met their match.

The relevant jquery code, controller code, and whatnot is all identical between the form_tag and the link_to tags.

Thanks and all.

like image 827
Negatratoron Avatar asked Jul 17 '11 00:07

Negatratoron


1 Answers

<%= link_to assignment.name, {:action => :view_student_problem_set}, :remote => true %>
like image 106
fl00r Avatar answered Sep 23 '22 16:09

fl00r