Ruby on rails 我怎么做这个手术?在脚手架上
我正在使用轨道创建脚手架。 这是我的索引页Ruby on rails 我怎么做这个手术?在脚手架上,ruby-on-rails,ajax,scaffold,Ruby On Rails,Ajax,Scaffold,我正在使用轨道创建脚手架。 这是我的索引页 <%- model_class = Tasktodo -%> <div class="page-header"> <h1><%=t 'title', :default => model_class.model_name.human.pluralize %></h1> </div> <table class="table table-striped">
<%- model_class = Tasktodo -%>
<div class="page-header">
<h1><%=t 'title', :default => model_class.model_name.human.pluralize %></h1>
</div>
<table class="table table-striped">
<thread>
<tr>
<th><%= model_class.human_attribute_name(:id) %></th>
<th><%= model_class.human_attribute_name(:name) %></th>
<th><%= model_class.human_attribute_name(:tname) %></th>
<th><%= model_class.human_attribute_name(:created_at) %></th>
<th><%=t '.actions', :default => t("helpers.actions") %></th>
</tr>
</thead>
<tbody>
<div id="edit">
<% @tasktodos.each do |tasktodo| %>
<tr>
<td><%= link_to tasktodo.id, tasktodo_path(tasktodo) %></td>
<td><a href="#" onclick="inedit()" style="text-decoration:none"><%= tasktodo.name %></a></td>
<td><%= tasktodo.tname %></td>
<td><%=l tasktodo.created_at %></td>
<td>
</div>
<%= link_to t('.edit', :default => t("helpers.links.edit")),
edit_tasktodo_path(tasktodo), :class => 'btn btn-mini' %>
model\u class.model\u name.human.pluralize%>
t(“helpers.actions”)%>
t(“helpers.links.edit”),
编辑_tasktodo_路径(tasktodo),:class=>'btn btn mini'>
若我点击编辑按钮,意味着。它将进入编辑页面,就像下一页一样。。
现在我想在不点击服务器的情况下进行操作。意思是当我单击时不要进入下一页。
所有操作只能在同一页中完成。
使用Ajax,我如何做这个操作?我能提供的最好的链接就是这个链接 按照这个步骤,您将能够使用RoR和JQuery(使用Ajax)构建CRUD scaffhold
希望这有帮助您可以通过执行
内联编辑
或在索引页中使用部分编辑表单,并从中进行更新来实现这一点。这是一个开放式回答问题,有多种方法可以做到这一点。