Rails before_filter and action identification

前端 未结 1 961
不思量自难忘°
不思量自难忘° 2021-02-13 18:52

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:46

    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)
提交回复
热议问题