Sha256: d78f71b5a854dee6bd07fdcd9824f2404197c8457df3e875966b585c6b824225
Contents?: true
Size: 863 Bytes
Versions: 5
Compression:
Stored size: 863 Bytes
Contents
if Grape::App.config.raise_on_missing_translations handler = lambda {|exception, *| exception = exception.to_exception if exception.respond_to?(:to_exception); raise exception } I18n.exception_handler = handler end if defined?(ActiveRecord) require 'yaml' require 'erb' configurations = YAML.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.default_timezone = :utc ActiveRecord::Base.establish_connection(Grape::App.env.to_sym) if defined?(ActiveRecord::ConnectionAdapters::ConnectionManagement) Grape::App.middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement end end
Version data entries
5 entries across 5 versions & 1 rubygems