Permalink
Browse files

Only define a model class if it doesn't exist

  • Loading branch information...
ianwhite committed Aug 18, 2010
1 parent cdee8f0 commit 0f6388f42482a2154b471166a27f987cab00c07e
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/git_friendly_dumper.rb
@@ -129,7 +129,11 @@ def load_fixtures
table = fixture.split('/').first
if (!tables || tables.include?(table))
unless fixtures_tables.include?(table)
- eval "class ::#{table.classify} < ActiveRecord::Base; end"
+ begin
+ "::#{table.classify}".constantize
+ rescue NameError
+ eval "class ::#{table.classify} < ActiveRecord::Base; end"
+ end
fixtures_tables << table
end
fixture

0 comments on commit 0f6388f

Please sign in to comment.