Skip to content

Commit

Permalink
Merge pull request #125 from owst/support_rails_71
Browse files Browse the repository at this point in the history
Add support for Rails 7.1
  • Loading branch information
rzane authored Nov 21, 2023
2 parents c5ec16c + c47fe53 commit a91bf4e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion baby_squeel.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |spec|

spec.files = Dir.glob('{lib/**/*,*.{md,txt,gemspec}}')

spec.add_dependency 'activerecord', '>= 6.1', '< 7.1'
spec.add_dependency 'activerecord', '>= 6.1.5', '< 7.2'
spec.add_dependency 'ransack', '~> 4.1'

spec.add_development_dependency 'bundler', '~> 2'
Expand Down
2 changes: 1 addition & 1 deletion lib/baby_squeel/nodes/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _arel
# Conveniently, this approach automatically adds a 1=0.
# I have literally no idea why, but I'll take it.
def sanitize_relation(rel)
if rel.kind_of? ::ActiveRecord::NullRelation
if ::ActiveRecord::VERSION::MAJOR < 7 && rel.kind_of?(::ActiveRecord::NullRelation)
other = rel.spawn
other.extending_values -= [::ActiveRecord::NullRelation]
sanitize_relation rel.unscoped.merge(other)
Expand Down
7 changes: 6 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
require 'support/factories'
require 'support/query_tracker'

ActiveSupport::Deprecation.behavior = :raise
if ActiveSupport.respond_to?(:deprecator)
ActiveSupport.deprecator.behavior = :raise
ActiveRecord.deprecator.behavior = :raise
else
ActiveSupport::Deprecation.behavior = :raise
end

RSpec.configure do |config|
config.include Factories
Expand Down

0 comments on commit a91bf4e

Please sign in to comment.