Sha256: 9626c20cb6b11da8d5630cb4a3eb1fc31daeabfb6f2dfc0f32ba76cd8d5b3f1e
Contents?: true
Size: 592 Bytes
Versions: 6
Compression:
Stored size: 592 Bytes
Contents
if defined?(ActiveRecord) require 'yaml' require 'erb' configurations = YAML.safe_load(ERB.new(Grape::App.root.join('config', 'database.yml').read).result) || {} if ENV['DATABASE_URL'] configurations[Grape::App.env.to_s] ||= {} configurations[Grape::App.env.to_s]['url'] ||= ENV['DATABASE_URL'] end ActiveRecord::Base.configurations = configurations ActiveRecord::Base.establish_connection(Grape::App.env.to_sym) Grape::App.middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement if defined?(ActiveRecord::ConnectionAdapters::ConnectionManagement) end
Version data entries
6 entries across 6 versions & 1 rubygems