Permalink
Browse files

Merge pull request #1 from schnittchen/patch-1

Ensure models are loaded; support for STI; support for Mongoid
  • Loading branch information...
2 parents 97389bf + 25a78ce commit a40f2a26e15332dcf19023af2bb83e3685cebd04 @joernchen committed Mar 26, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 good_stuff/attr_scanner.rb
@@ -4,8 +4,15 @@
# should be run from rails console in production
# environment.
+#make sure all models are loaded
+Dir[Rails.root + 'app/models/**/*.rb'].each { |path| require path }
-ActiveRecord::Base.subclasses.each do |m|
+models = ActiveRecord::Base.subclasses
+## for mongoid:
+# ObjectSpace.each(Class).select { |c| c < Mongoid::Document }
+## (does not work in all rubies)
+
+models.each do |m|
mod = m.new
puts "All attributes for model #{m}:"
mod.attributes.each_key do |k|

0 comments on commit a40f2a2

Please sign in to comment.