得到rails应用中的所有model名

Wednesday, September 29, 2010

代码

ActiveRecord::Base.send(:subclasses).each do |model|
  puts model.name
end

This entry was tagged Rails and tips

comments powered by Disqus

© 2009-2013 lxneng.com. All rights reserved. Powered by Pyramid

go to Top