在rails 5中处理Link_to_remote

时间:2017-07-28 02:52:37

标签: ruby-on-rails ruby-on-rails-5

我想从rails 2转到5,但Rails 5不支持link_to_remote

<%= link_to_remote "Add", 
  :url=>{:action=>'fee_submission',:batch=>@batch,s_id=>@stud_id}

在控制器中:

def fee_submission
  # ..some code..
  render :update do |page|
  page.replace_html "fee", :partial => "fees"
end

查看_fees.html.erb:

<html>
  code
</html>

如何在Rails 5中实现上述代码?

1 个答案:

答案 0 :(得分:1)

可能你可以在link_to here is link for more detail

的参数选项中使用remote:true
<%= link_to "Add", fee_submission_controller_path, remote: true %>