Rails before_filter and action identification

前端 未结 1 771
生来不讨喜
生来不讨喜 2021-02-13 19:18

I want to write a before_filter in my controller to identify the action which will execute next. This is for authorization purposes (this is somewhat like role_requirement plugi

相关标签:
1条回答
  • 2021-02-13 19:52

    The action_name method on the controller should give you what you're looking for. It's not documented, though, so there is no guarantee it won't disappear someday.

    before_filter { |controller| logger.debug "Running before the #{controller.action_name} action" }
    
    0 讨论(0)
提交回复
热议问题