Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Ensure models are loaded; support for STI; support for Mongoid #1

merged 1 commit into from

2 participants


No description provided.

@joernchen joernchen merged commit a40f2a2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2012
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 good_stuff/attr_scanner.rb
9 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 =
puts "All attributes for model #{m}:"
mod.attributes.each_key do |k|
Something went wrong with that request. Please try again.