遍历应用程序/模型并查看每个文件的类的方法不是我想要的
答案 0 :(得分:0)
是的,您可以:Is there a way to get a collection of all the Models in your Rails app?
例如:
Module.constants.select do |constant_name|
constant = eval constant_name
if not constant.nil? and constant.is_a? Class and constant.superclass == ActiveRecord::Base
constant
end
end