diff --git a/CHANGELOG.md b/CHANGELOG.md index 53d8581..0398cc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.1.0] - 2024-12-22 + +- Support Active Record prior to 8.0.1 + ## [1.0.0] - 2024-12-22 - Initial release diff --git a/Gemfile.lock b/Gemfile.lock index 6422333..1563d85 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,7 @@ PATH remote: . specs: - activemodel-with_conditions (1.0.0) - activemodel + activemodel-with_conditions (1.1.0) GEM remote: https://rubygems.org/ diff --git a/activemodel-with_conditions.gemspec b/activemodel-with_conditions.gemspec index 93c47cb..f166e0c 100644 --- a/activemodel-with_conditions.gemspec +++ b/activemodel-with_conditions.gemspec @@ -28,6 +28,4 @@ Gem::Specification.new do |spec| spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - - spec.add_dependency "activemodel" end diff --git a/lib/with_conditions.rb b/lib/with_conditions.rb index 6b65822..91db1cb 100644 --- a/lib/with_conditions.rb +++ b/lib/with_conditions.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "active_model" require_relative "with_conditions/options_merger" require_relative "with_conditions/version" @@ -16,13 +15,7 @@ def with_conditions(if: nil, unless: nil, &block) end end -module ActiveModel - module API - singleton_class.prepend(Module.new do - def included(klass) - super - klass.extend WithConditions - end - end) - end -end +# To keep things simple, we include this in all objects, like `with_options`. +# +# Otherwise we would want specs that include Active Record, and we'd want to consider that different versions of Rails use Active Model in different ways (e.g. only recent Rails per 2024-12-22 include ActiveModel::API in ActiveRecord::Base`). +Object.extend WithConditions diff --git a/lib/with_conditions/version.rb b/lib/with_conditions/version.rb index db25bbd..17e221f 100644 --- a/lib/with_conditions/version.rb +++ b/lib/with_conditions/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WithConditions - VERSION = "1.0.0" + VERSION = "1.1.0" end