baby_squeel 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -5
- data/lib/baby_squeel/active_record/calculations.rb +2 -0
- data/lib/baby_squeel/join_dependency/builder.rb +12 -1
- data/lib/baby_squeel/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea748a7c86d1947f7fe48e799eb2ced9f7741a63
|
4
|
+
data.tar.gz: f9196d9756b6cb9b461d654112cfc0818ced9b62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 040230635cc12c89d661c622b6e3b43f84d0fb37fd320a0ab570560d605fa170287d594ef810d27d7cd33278c15aeba609bdb1d71cdc28cc00bd0f6b0743dff5
|
7
|
+
data.tar.gz: db3975104c6c290c712fd3833e1bf469ae93e4ec262d861f1504b1f6fe9f15bada5ccebac0e43871fa61583688bf758d0d352af3bff4b7dc5e5cc9092d8c7979
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
## [
|
2
|
-
|
3
|
-
|
1
|
+
## [1.1.1] - 2017-02-14
|
2
|
+
### Fixed
|
3
|
+
- There is a bug in Active Record where the `AliasTracker` initializes `Arel::Table`s use the wrong `type_caster`. To address this, BabySqueel must re-initialize the `Arel::Table` with the correct `type_caster` (#54).
|
4
4
|
|
5
5
|
## [1.1.0] - 2017-02-10
|
6
6
|
> This version drops support for Active Record 4.1. If you're stil on 4.1, you should seriously consider upgrading to at least 4.2.
|
7
7
|
|
8
8
|
### Added
|
9
|
-
- DSLs for ActiveRecord::Relation::Calculations. You can
|
9
|
+
- DSLs for ActiveRecord::Relation::Calculations. You can now use `plucking`, `counting`, `summing`, `averaging`, `minimizing`, and `maximizing`.
|
10
10
|
|
11
11
|
## [1.0.3] - 2017-02-09
|
12
12
|
### Added
|
@@ -99,7 +99,8 @@ Nothing to see yet!
|
|
99
99
|
### Added
|
100
100
|
- Initial support for selects, orders, wheres, and joins.
|
101
101
|
|
102
|
-
[Unreleased]: https://github.com/rzane/baby_squeel/compare/v1.1.
|
102
|
+
[Unreleased]: https://github.com/rzane/baby_squeel/compare/v1.1.1...HEAD
|
103
|
+
[1.1.1]: https://github.com/rzane/baby_squeel/compare/v1.1.0...v1.1.1
|
103
104
|
[1.1.0]: https://github.com/rzane/baby_squeel/compare/v1.0.3...v1.1.0
|
104
105
|
[1.0.3]: https://github.com/rzane/baby_squeel/compare/v1.0.2...v1.0.3
|
105
106
|
[1.0.2]: https://github.com/rzane/baby_squeel/compare/v1.0.1...v1.0.2
|
@@ -37,11 +37,22 @@ module BabySqueel
|
|
37
37
|
# a list (in order of chaining) of associations and finding
|
38
38
|
# the respective JoinAssociation at each level.
|
39
39
|
def find_alias(associations)
|
40
|
-
find_join_association(associations).table
|
40
|
+
table = find_join_association(associations).table
|
41
|
+
reconstruct_with_type_caster(table, associations)
|
41
42
|
end
|
42
43
|
|
43
44
|
private
|
44
45
|
|
46
|
+
# Active Record 5's AliasTracker initializes Arel tables
|
47
|
+
# with the type_caster belonging to the wrong model.
|
48
|
+
#
|
49
|
+
# See: https://github.com/rails/rails/pull/27994
|
50
|
+
def reconstruct_with_type_caster(table, associations)
|
51
|
+
return table if ::ActiveRecord::VERSION::MAJOR < 5
|
52
|
+
type_caster = associations.last._scope.type_caster
|
53
|
+
::Arel::Table.new(table.name, type_caster: type_caster)
|
54
|
+
end
|
55
|
+
|
45
56
|
def join_list
|
46
57
|
join_nodes + join_strings_as_ast
|
47
58
|
end
|
data/lib/baby_squeel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baby_squeel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ray Zane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
153
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.5.2
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: An expressive query DSL for Active Record 4 and 5.
|