Sha256: d2ee75996830367fe63381897b76d72729ea6a0ac335f69c259bc9f892fe64c0

Contents?: true

Size: 447 Bytes

Versions: 4

Compression:

Stored size: 447 Bytes

Contents

module VersionedSeeds
  module Utils
    if defined?(Rails)
      def self.load_sql(path)
        sql_file    = VersionedSeeds.root_path + 'db/seeds/' + path
        db_password = db_config['password']

        system "RAILS_ENV=#{Rails.env} bundle exec rails dbconsole -p #{db_password} < #{sql_file}"
      end

      def self.db_config
        @db_config = Rails.application.config.database_configuration[Rails.env]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
versioned_seeds-0.5.0 lib/versioned_seeds/utils.rb
versioned_seeds-0.4.0 lib/versioned_seeds/utils.rb
versioned_seeds-0.3.1 lib/versioned_seeds/utils.rb
versioned_seeds-0.3.0 lib/versioned_seeds/utils.rb