lib/grape/app/initializers/post.rb in grape-app-0.8.8 vs lib/grape/app/initializers/post.rb in grape-app-0.9.0
- old
+ new
@@ -11,11 +11,15 @@
if ENV['DATABASE_URL']
configurations[Grape::App.env.to_s] ||= {}
configurations[Grape::App.env.to_s]['url'] ||= ENV['DATABASE_URL']
end
+ if ActiveRecord.respond_to?(:default_timezone=)
+ ActiveRecord.default_timezone = :utc
+ else
+ ActiveRecord::Base.default_timezone = :utc
+ end
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 if defined?(ActiveRecord::ConnectionAdapters::ConnectionManagement)
end