Module: SeedFixtures::Implementation

Defined in:
lib/seed_fixtures/implementation.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.truncate_and_seedObject



6
7
8
9
# File 'lib/seed_fixtures/implementation.rb', line 6

def truncate_and_seed
  ActiveRecord::Tasks::DatabaseTasks.truncate_all
  Rails.application.load_seed
end

Instance Method Details

#load_fixturesObject



12
13
14
15
16
17
18
19
20
# File 'lib/seed_fixtures/implementation.rb', line 12

def load_fixtures(*)
  return if defined?(@@has_loaded_fixtures)

  unless_seeds_in_db_match_files do
    SeedFixtures::Implementation.truncate_and_seed
  end

  @@has_loaded_fixtures = true
end