Permalink
Browse files

Handle edge case where table name matches a global module name

  • Loading branch information...
1 parent 9caebd9 commit 8b3d837e12377ba9e0cb25300ae86404fd1633d6 Isaac Sparling committed Oct 30, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/fixture_builder/builder.rb
@@ -88,7 +88,7 @@ def dump_tables
begin
fixtures = tables.inject([]) do |files, table_name|
table_klass = table_name.classify.constantize rescue nil
- if table_klass
+ if table_klass && table_klass < ActiveRecord::Base
rows = table_klass.unscoped { table_klass.all.collect(&:attributes) }
else
rows = ActiveRecord::Base.connection.select_all(select_sql % ActiveRecord::Base.connection.quote_table_name(table_name))
@@ -120,4 +120,4 @@ def fixture_file(table_name)
fixtures_dir("#{table_name}.yml")
end
end
-end
+end

0 comments on commit 8b3d837

Please sign in to comment.