How to get all models,controller,action and method names in Rails
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
精彩评论