(Rails)的就地通过“索引”页面属性进行编辑
-
12-09-2019 - |
题
我期待用“in_place_editor_field”项目的“索引”页面上。基本上我想模仿预先存在的行项目电子表格功能,以编辑它们的属性。但是,没有我所见过的“in_place_editor”的例子提供任何这种性质的有用的现实世界的应用程序。
另外,很多现有的代码的例子不工作。我知道,代码是从核心删除,但即使安装它作为一个插件之后,它似乎并没有做任何事情。
任何想法?
最佳。
解决方案
我想要做同样的事情。我发现了一个例子,在 http://docs.activestate.com/komodo/5.0 /tutorial/railstut.html 一路滚动到底部,并期待在index.html.erb。
诀窍是,in_place_editor_field需要在一个实例变量工作,所以你的循环里面,你需要设置一个实例变量,并传递给标签。
其他提示
我认为本实施例中是更好的:
<table>
<tr>
<th>First name</th>
<th>Last name</th>
</tr>
<% @person.each do |person| %>
<tr>
<td><%= best_in_place person, :first_name %></td>
<td><%= best_in_place person, :last_name %></td>
</tr>
<% end %>
</table>
我得到这个从此页一>
不隶属于 StackOverflow