当我将以下代码添加到lib
时https://github.com/collectiveidea/audited/pull/381/files
我不知道如何在视野中打电话。你能告诉我如何称呼这种方法吗?
我在考虑http://github.com/airblade/paper_trail,但我不想拥有很多宝石。
答案 0 :(得分:0)
1.创建撤消链接操作的URL /路由
的routes.rb
get 'undo', to: 'audit#undo'
2.创建其控制器/动作
audit_controller.rb
def undo
current_user.audits.last.undo
end
3.在视图中添加撤消链接
your_view.html.erb
<a href="/undo"></a>