baby_squeel 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/ISSUE_TEMPLATE.md +1 -1
- data/README.md +19 -1
- data/baby_squeel.gemspec +2 -2
- data/lib/baby_squeel/active_record/calculations.rb +1 -1
- data/lib/baby_squeel/active_record/query_methods.rb +0 -1
- data/lib/baby_squeel/active_record/version_helper.rb +5 -0
- data/lib/baby_squeel/association.rb +0 -1
- data/lib/baby_squeel/join_dependency.rb +3 -1
- data/lib/baby_squeel/nodes/attribute.rb +1 -12
- data/lib/baby_squeel/nodes/proxy.rb +1 -1
- data/lib/baby_squeel/version.rb +1 -1
- data/lib/baby_squeel.rb +5 -4
- metadata +7 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d571146af43e191254a5673d5486af29b31a8762f3f169075cef91ff50bdb09
|
|
4
|
+
data.tar.gz: aedddf1851a4507025d7b291db17c7dcee4ac93c2c66a44f289db031b1872afb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18d9b7499e8e3b1e0d9f015e6dc2ca1bf89e35d7ca161a9c29a8b0979e57d142698b66d428d27a9f791a2d29c8275352f1b30d6a784d893e183e204d7c006062
|
|
7
|
+
data.tar.gz: 07c5c306ca8b90756234cecd9ac1eb2463c959ac4e5caedd91fd38e5bf8cb356c6ab438819400c247a7f799a1802d3a93109c43b6804e27a3f68c66a41526827
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [4.0.0] - 2024-11-29
|
|
4
|
+
|
|
5
|
+
- Remove ActiveRecord boundary
|
|
6
|
+
- Added support for ActiveRecord 8.1
|
|
7
|
+
- Added support for Ransack 4.4 (#134)
|
|
8
|
+
- Added support for ActiveRecord 8.0
|
|
9
|
+
- Added support for ActiveRecord 7.2
|
|
10
|
+
- Droped support for ActiveRecord 6.1 and 7.0
|
|
11
|
+
- Added Ruby 3.3 and 3.4 to test matrix
|
|
12
|
+
- Droped support for Ruby 3.0 and 3.1
|
|
13
|
+
|
|
3
14
|
## [3.0.0] - 2023-11-20
|
|
4
15
|
|
|
5
16
|
- Added support for ActiveRecord 7.1 (#125)
|
|
@@ -244,7 +255,8 @@
|
|
|
244
255
|
|
|
245
256
|
- Initial support for selects, orders, wheres, and joins.
|
|
246
257
|
|
|
247
|
-
[unreleased]: https://github.com/rzane/baby_squeel/compare/
|
|
258
|
+
[unreleased]: https://github.com/rzane/baby_squeel/compare/v4.0.0...HEAD
|
|
259
|
+
[4.0.0]: https://github.com/rzane/baby_squeel/compare/v3.0.0...v4.0.0
|
|
248
260
|
[3.0.0]: https://github.com/rzane/baby_squeel/compare/v2.0.0...v3.0.0
|
|
249
261
|
[2.0.0]: https://github.com/rzane/baby_squeel/compare/v1.4.4...v2.0.0
|
|
250
262
|
[1.4.4]: https://github.com/rzane/baby_squeel/compare/v1.4.3...v1.4.4
|
data/ISSUE_TEMPLATE.md
CHANGED
|
@@ -11,7 +11,7 @@ require 'minitest/autorun'
|
|
|
11
11
|
|
|
12
12
|
gemfile true do
|
|
13
13
|
source 'https://rubygems.org'
|
|
14
|
-
gem 'activerecord', '~> 7.
|
|
14
|
+
gem 'activerecord', '~> 7.1.5' # which Active Record version?
|
|
15
15
|
gem 'sqlite3'
|
|
16
16
|
gem 'baby_squeel', github: 'rzane/baby_squeel'
|
|
17
17
|
end
|
data/README.md
CHANGED
|
@@ -329,12 +329,30 @@ Check out the [migration guide](https://github.com/rzane/baby_squeel/wiki/Migrat
|
|
|
329
329
|
|
|
330
330
|
## Development
|
|
331
331
|
|
|
332
|
-
1. Pick an Active Record version to develop against, then export it: `export AR=
|
|
332
|
+
1. Pick an Active Record version to develop against, then export it: `export AR=7.2.2`.
|
|
333
333
|
2. Run `bin/setup` to install dependencies.
|
|
334
334
|
3. Run `rake` to run the specs.
|
|
335
335
|
|
|
336
|
+
One-liner to run the specs with different rails versions:
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
export AR='~> 7.1.6'; rm Gemfile.lock; bin/setup; rake
|
|
340
|
+
export AR='~> 7.2.3'; rm Gemfile.lock; bin/setup; rake
|
|
341
|
+
export AR='~> 8.0.4'; rm Gemfile.lock; bin/setup; rake
|
|
342
|
+
export AR='~> 8.1.1'; rm Gemfile.lock; bin/setup; rake
|
|
343
|
+
```
|
|
344
|
+
|
|
336
345
|
You can also run `bin/console` to open up a prompt where you'll have access to some models to experiment with.
|
|
337
346
|
|
|
347
|
+
## Rails update
|
|
348
|
+
|
|
349
|
+
1. Update [baby_squeel.gemspec](baby_squeel.gemspec)
|
|
350
|
+
2. Add the version to test matrix [build.yml](.github/workflows/build.yml)
|
|
351
|
+
3. Update development section in the [README.md](README.md)
|
|
352
|
+
4. If you need to change the code consider to add a version check methode in [version_helper.rb](lib/baby_squeel/active_record/version_helper.rb)
|
|
353
|
+
5. Run the specs with all supported versions
|
|
354
|
+
6. Add comment to the unreleased section in [CHANGELOG.md](CHANGELOG.md)
|
|
355
|
+
|
|
338
356
|
## Contributing
|
|
339
357
|
|
|
340
358
|
Bug reports and pull requests are welcome on GitHub at https://github.com/rzane/baby_squeel.
|
data/baby_squeel.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.authors = ['Ray Zane']
|
|
10
10
|
spec.email = ['ray@promptworks.com']
|
|
11
11
|
|
|
12
|
-
spec.summary = 'An expressive query DSL for Active Record
|
|
12
|
+
spec.summary = 'An expressive query DSL for Active Record 7.1+'
|
|
13
13
|
spec.description = spec.summary
|
|
14
14
|
spec.homepage = 'https://github.com/rzane/baby_squeel'
|
|
15
15
|
spec.license = 'MIT'
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
|
|
20
20
|
spec.files = Dir.glob('{lib/**/*,*.{md,txt,gemspec}}')
|
|
21
21
|
|
|
22
|
-
spec.add_dependency 'activerecord', '>=
|
|
22
|
+
spec.add_dependency 'activerecord', '>= 7.1.5'
|
|
23
23
|
spec.add_dependency 'ransack', '~> 4.1'
|
|
24
24
|
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 2'
|
|
@@ -10,6 +10,11 @@ module BabySqueel
|
|
|
10
10
|
# ::ActiveRecord::VERSION::MAJOR > 7 ||
|
|
11
11
|
# ::ActiveRecord::VERSION::MAJOR == 7 && ::ActiveRecord::VERSION::MINOR >= 1
|
|
12
12
|
# end
|
|
13
|
+
|
|
14
|
+
def self.at_least_7_2?
|
|
15
|
+
::ActiveRecord::VERSION::MAJOR > 7 ||
|
|
16
|
+
::ActiveRecord::VERSION::MAJOR == 7 && ::ActiveRecord::VERSION::MINOR >= 2
|
|
17
|
+
end
|
|
13
18
|
end
|
|
14
19
|
end
|
|
15
20
|
end
|
|
@@ -119,7 +119,9 @@ module BabySqueel
|
|
|
119
119
|
|
|
120
120
|
join_list = join_nodes + joins
|
|
121
121
|
|
|
122
|
-
alias_tracker = Associations::AliasTracker.create(
|
|
122
|
+
alias_tracker = Associations::AliasTracker.create(
|
|
123
|
+
BabySqueel::ActiveRecord::VersionHelper.at_least_7_2? ? relation.klass.connection_pool : relation.klass.connection,
|
|
124
|
+
relation.table.name, join_list)
|
|
123
125
|
join_dependency = Associations::JoinDependency.new(relation.klass, relation.table, association_joins, Arel::Nodes::InnerJoin)
|
|
124
126
|
join_dependency.instance_variable_set(:@alias_tracker, alias_tracker)
|
|
125
127
|
|
|
@@ -35,19 +35,8 @@ module BabySqueel
|
|
|
35
35
|
|
|
36
36
|
private
|
|
37
37
|
|
|
38
|
-
# NullRelation must be treated as a special case, because
|
|
39
|
-
# NullRelation#to_sql returns an empty string. As such,
|
|
40
|
-
# we need to convert the NullRelation to regular relation.
|
|
41
|
-
# Conveniently, this approach automatically adds a 1=0.
|
|
42
|
-
# I have literally no idea why, but I'll take it.
|
|
43
38
|
def sanitize_relation(rel)
|
|
44
|
-
|
|
45
|
-
other = rel.spawn
|
|
46
|
-
other.extending_values -= [::ActiveRecord::NullRelation]
|
|
47
|
-
sanitize_relation rel.unscoped.merge(other)
|
|
48
|
-
else
|
|
49
|
-
Arel.sql rel.to_sql
|
|
50
|
-
end
|
|
39
|
+
Arel.sql(rel.to_sql)
|
|
51
40
|
end
|
|
52
41
|
end
|
|
53
42
|
end
|
|
@@ -2,7 +2,7 @@ module BabySqueel
|
|
|
2
2
|
module Nodes
|
|
3
3
|
# This proxy class allows us to quack like any arel object. When a
|
|
4
4
|
# method missing is hit, we'll instantiate a new proxy object.
|
|
5
|
-
class Proxy <
|
|
5
|
+
class Proxy < BasicObject
|
|
6
6
|
# Resolve constants the normal way
|
|
7
7
|
def self.const_missing(name)
|
|
8
8
|
::Object.const_get(name)
|
data/lib/baby_squeel/version.rb
CHANGED
data/lib/baby_squeel.rb
CHANGED
|
@@ -4,10 +4,6 @@ require 'active_record/relation'
|
|
|
4
4
|
require 'polyamorous/polyamorous'
|
|
5
5
|
require 'baby_squeel/version'
|
|
6
6
|
require 'baby_squeel/errors'
|
|
7
|
-
require 'baby_squeel/active_record/base'
|
|
8
|
-
require 'baby_squeel/active_record/query_methods'
|
|
9
|
-
require 'baby_squeel/active_record/calculations'
|
|
10
|
-
require 'baby_squeel/active_record/where_chain'
|
|
11
7
|
|
|
12
8
|
module BabySqueel
|
|
13
9
|
class << self
|
|
@@ -43,6 +39,11 @@ module BabySqueel
|
|
|
43
39
|
end
|
|
44
40
|
|
|
45
41
|
ActiveSupport.on_load :active_record do
|
|
42
|
+
require 'baby_squeel/active_record/base'
|
|
43
|
+
require 'baby_squeel/active_record/query_methods'
|
|
44
|
+
require 'baby_squeel/active_record/calculations'
|
|
45
|
+
require 'baby_squeel/active_record/where_chain'
|
|
46
|
+
|
|
46
47
|
::ActiveRecord::Base.extend BabySqueel::ActiveRecord::Base
|
|
47
48
|
::ActiveRecord::Relation.prepend BabySqueel::ActiveRecord::QueryMethods
|
|
48
49
|
::ActiveRecord::Relation.prepend BabySqueel::ActiveRecord::Calculations
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: baby_squeel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ray Zane
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activerecord
|
|
@@ -16,20 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
20
|
-
- - "<"
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: '7.2'
|
|
18
|
+
version: 7.1.5
|
|
23
19
|
type: :runtime
|
|
24
20
|
prerelease: false
|
|
25
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
22
|
requirements:
|
|
27
23
|
- - ">="
|
|
28
24
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
30
|
-
- - "<"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '7.2'
|
|
25
|
+
version: 7.1.5
|
|
33
26
|
- !ruby/object:Gem::Dependency
|
|
34
27
|
name: ransack
|
|
35
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,7 +93,7 @@ dependencies:
|
|
|
100
93
|
- - ">="
|
|
101
94
|
- !ruby/object:Gem::Version
|
|
102
95
|
version: '0'
|
|
103
|
-
description: An expressive query DSL for Active Record
|
|
96
|
+
description: An expressive query DSL for Active Record 7.1+
|
|
104
97
|
email:
|
|
105
98
|
- ray@promptworks.com
|
|
106
99
|
executables: []
|
|
@@ -141,7 +134,6 @@ homepage: https://github.com/rzane/baby_squeel
|
|
|
141
134
|
licenses:
|
|
142
135
|
- MIT
|
|
143
136
|
metadata: {}
|
|
144
|
-
post_install_message:
|
|
145
137
|
rdoc_options: []
|
|
146
138
|
require_paths:
|
|
147
139
|
- lib
|
|
@@ -156,8 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
156
148
|
- !ruby/object:Gem::Version
|
|
157
149
|
version: '0'
|
|
158
150
|
requirements: []
|
|
159
|
-
rubygems_version: 3.
|
|
160
|
-
signing_key:
|
|
151
|
+
rubygems_version: 3.6.9
|
|
161
152
|
specification_version: 4
|
|
162
|
-
summary: An expressive query DSL for Active Record
|
|
153
|
+
summary: An expressive query DSL for Active Record 7.1+
|
|
163
154
|
test_files: []
|