How to get list of controllers and actions in ruby on rails?

前端 未结 4 742
你的背包
你的背包 2020-12-07 20:50

In rails, I can get the name of the current controller via controller_name and the current action by calling action_name. I am looking for similar runtime reflection for fet

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 21:13

    PostsController.action_methods will return all actions of PostsController including inherited, it's not what I want, I found PostsController.instance_methods(false), which will return all instance methods of PostsController and not include inherited, exactly what I want.

提交回复
热议问题