lib/grape/app/initializers/post.rb in grape-app-0.3.4 vs lib/grape/app/initializers/post.rb in grape-app-0.3.5
- old
+ new
@@ -1,13 +1,14 @@
if Grape::App.config.raise_on_missing_translations
- handler = -> (exception, *) { exception = exception.to_exception if exception.respond_to?(:to_exception); raise exception }
+ 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(Grape::App.root.join('config', 'database.yml').read)
+ configurations = YAML.load(ERB.new(Grape::App.root.join('config', 'database.yml').read).result)
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)