lib/grape/app/initializers/pre.rb in grape-app-0.11.1 vs lib/grape/app/initializers/pre.rb in grape-app-0.11.2
- old
+ new
@@ -6,10 +6,11 @@
end
ActiveSupport::Digest.hash_digest_class = OpenSSL::Digest::SHA256
ActiveSupport::KeyGenerator.hash_digest_class = OpenSSL::Digest::SHA256 if ActiveSupport::KeyGenerator.respond_to?(:hash_digest_class=)
ActiveSupport::MessageEncryptor.use_authenticated_message_encryption = true
ActiveSupport::IsolatedExecutionState.isolation_level = :thread if defined?(ActiveSupport::IsolatedExecutionState)
+# This is legacy and removed in removed with Rails 7.1
Digest::UUID.use_rfc4122_namespaced_uuids = true if Digest::UUID.respond_to?(:use_rfc4122_namespaced_uuids=)
# Set default time-zone
begin
TZInfo::DataSource.get
@@ -41,13 +42,16 @@
ActiveRecord.default_timezone = :utc
else
ActiveRecord::Base.default_timezone = :utc
end
- if ActiveRecord.respond_to?(:legacy_connection_handling=)
- ActiveRecord.legacy_connection_handling = false
- else
- ActiveRecord::Base.legacy_connection_handling = false
+ # legacy_connection_handling was deprecated in ActiveRecord 7
+ if ActiveRecord::VERSION::MAJOR < 7
+ if ActiveRecord.respond_to?(:legacy_connection_handling=)
+ ActiveRecord.legacy_connection_handling = false
+ else
+ ActiveRecord::Base.legacy_connection_handling = false
+ end
end
ActiveRecord.tap do |c|
c.verify_foreign_keys_for_fixtures = true if c.respond_to?(:verify_foreign_keys_for_fixtures=)
end