开发者

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

开发者 https://www.devze.com 2023-03-20 16:26 出处:网络
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

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_set开发者_高级运维s", :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.


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

精彩评论

暂无评论...
验证码 换一张
取 消