Skip to content

Commit

Permalink
Merge pull request #19 from okcwest/master
Browse files Browse the repository at this point in the history
Handle edge case where table name matches a global module name
  • Loading branch information
rdy committed Oct 30, 2012
2 parents 2d56723 + 8b3d837 commit 3cb14d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fixture_builder/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -120,4 +120,4 @@ def fixture_file(table_name)
fixtures_dir("#{table_name}.yml")
end
end
end
end

0 comments on commit 3cb14d5

Please sign in to comment.