First, make sure all your models are loaded (this can take some time) (
cache_classes
must be on, which it is by default in development mode):Rails.application.eager_load!
Then get an array of all ActiveRecord::Base sub-classes. It also get sub-classes of sub-classes, by the way.
ary = ActiveRecord::Base.descendants
Then you just need to list them:
puts ary.map {|m| "#{m.to_s} ~ :#{m.column_names.join ', :'}" }.join("\n")
Here is a useful page about preparing the upgrade to Rails 4, by the way:
https://iprog.com/posting/2013/07/preparing-for-an-upgrade-to-rails-4-0
No comments:
Post a Comment