Sha256: ede21b7cab133cdba35586974dd7b16fb22594ea66ae8e08dfd940003e024f29

Contents?: true

Size: 685 Bytes

Versions: 5

Compression:

Stored size: 685 Bytes

Contents

if Grape::App.config.raise_on_missing_translations
  handler = -> (exception, *) { exception = exception.to_exception if exception.respond_to?(:to_exception); raise exception }
  I18n.exception_handler = handler
end

if defined?(ActiveRecord)
  require 'yaml'

  configurations = YAML.load(Grape::App.root.join('config', 'database.yml').read)
  configurations[Grape::App.env.to_s]['url'] = ENV['DATABASE_URL'] if ENV['DATABASE_URL']

  ActiveRecord::Base.configurations = configurations
  ActiveRecord::Base.default_timezone = :utc
  ActiveRecord::Base.establish_connection(Grape::App.env.to_sym)

  Grape::App.middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grape-app-0.3.4 lib/grape/app/initializers/post.rb
grape-app-0.3.3 lib/grape/app/initializers/post.rb
grape-app-0.3.2 lib/grape/app/initializers/post.rb
grape-app-0.3.1 lib/grape/app/initializers/post.rb
grape-app-0.3.0 lib/grape/app/initializers/post.rb