Sha256: c148dcdacc9f6bc76eb1c7927dcb93c0a38f9040e418accda4f0d50fcf58b9eb

Contents?: true

Size: 560 Bytes

Versions: 1

Compression:

Stored size: 560 Bytes

Contents

require 'active_record/tasks/database_tasks'

module NamedSeeds
  class Railtie < Rails::Railtie

    config.named_seeds = ActiveSupport::OrderedOptions.new
    config.named_seeds.engines_with_load_seed = []

    config.before_initialize do |app|
      ActiveRecord::Tasks::DatabaseTasks.seed_loader = NamedSeeds::Railtie
    end

    def load_seed
      Rails.application.load_seed
      engines_load_seed
    end


    protected

    def engines_load_seed
      config.named_seeds.engines_with_load_seed.each { |engine| engine.load_seed }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
named_seeds-2.0.0 lib/named_seeds/railtie.rb