簡體   English   中英

在rails 5中處理Link_to_remote

[英]handle Link_to_remote in 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中實現?

可能您可以使用remote:從link_to的參數選項中為true, 這里是鏈接以獲取更多詳細信息

<%= link_to "Add", fee_submission_controller_path, remote: true %>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM