我正在为Ruby on Rails 3中的用户创建动作跟踪。我想在控制器中使用after_filter
方法,但我不知道如何在我的{{1}中获取当前对象或当前动作}} 方法。任何解决方案?
action_tracking
答案 0 :(得分:0)
def action_tracking
action = params[:action]
changes = changed_object.changes
changed_object.tracking.create(action, changes)
end
# override for each controller
# there is no way to know this in a generic way, unless you use something
# like inherited_resources, or active scaffold, where the objects is "known"
def changed_object
@user
end