Sha256: cad308444d8e6b8134353c369e9ac0c82bedb48bb7489e338f775be60d403da7
Contents?: true
Size: 651 Bytes
Versions: 13
Compression:
Stored size: 651 Bytes
Contents
# frozen_string_literal: true require 'rails-pg-extras' namespace :pg_extras do task :establish_connection do if ENV['DATABASE_URL'].present? ActiveRecord::Base.establish_connection(ENV['DATABASE_URL']) else db_config_file = File.read('config/database.yml') db_config = YAML::load(ERB.new(db_config_file).result) ActiveRecord::Base.establish_connection(db_config[Rails.env]) end end RailsPGExtras::QUERIES.each do |query_name| desc RubyPGExtras.description_for(query_name: query_name) task query_name.to_sym => :establish_connection do RailsPGExtras.public_send(query_name) end end end
Version data entries
13 entries across 13 versions & 1 rubygems