开发者

How to get all models,controller,action and method names in Rails

开发者 https://www.devze.com 2023-01-10 20:22 出处:网络
In runtime we can get the current controller and current action names by controller_name and action_name methods like wise,

In runtime we can get the current controller and current action names by controller_name and action_name methods like wise,

I want to get all the remaining controllers and action names and models too if possible..

Any rails method available to g开发者_StackOverflowet all the controller names and the action names in application controller.


@table_names =  ActiveRecord::Base.connection.tables
    @model_names = Array.new
    @model_names.each do |table_to_model|
      @model_names = @model_names.insert(@model_names.length,table_to_model.camelize.singularize) unless table_to_model.blank?
    end

This is how you get all Model name

0

精彩评论

暂无评论...
验证码 换一张
取 消