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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c05b66383b8b74c1c6ba92af1164da82a4290a2
4
- data.tar.gz: 19d23ae9dae15bc8f7b8acb91f18272f7101e9c7
3
+ metadata.gz: ea748a7c86d1947f7fe48e799eb2ced9f7741a63
4
+ data.tar.gz: f9196d9756b6cb9b461d654112cfc0818ced9b62
5
5
  SHA512:
6
- metadata.gz: 4ff0c39cba1d8b76911020f7b1a66affacddfb6dbe5a4e63a6cf7752f40bcdc30180fcfb95fa5437c495146469a30dbf7e73ceeddf5ca7fbb75d5c6810ff245b
7
- data.tar.gz: e765fd51a96096549e971be4a8ffd87a2ae24300475e49043eddf33b692500501f2a1ca3ca8933048aedc08ea60f18f9748dfc93d1bd69f84e5067a9cf9d2594
6
+ metadata.gz: 040230635cc12c89d661c622b6e3b43f84d0fb37fd320a0ab570560d605fa170287d594ef810d27d7cd33278c15aeba609bdb1d71cdc28cc00bd0f6b0743dff5
7
+ data.tar.gz: db3975104c6c290c712fd3833e1bf469ae93e4ec262d861f1504b1f6fe9f15bada5ccebac0e43871fa61583688bf758d0d352af3bff4b7dc5e5cc9092d8c7979
data/CHANGELOG.md CHANGED
@@ -1,12 +1,12 @@
1
- ## [Unreleased]
2
-
3
- Nothing to see yet!
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 not use `plucking`, `counting`, `summing`, `averaging`, `minimizing`, and `maximizing`.
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.0...HEAD
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
@@ -28,6 +28,8 @@ module BabySqueel
28
28
  maximum Calculation.new(DSL.evaluate(self, &block))
29
29
  end
30
30
 
31
+ private
32
+
31
33
  # @override
32
34
  def aggregate_column(column_name)
33
35
  if column_name.kind_of? Calculation
@@ -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
@@ -1,3 +1,3 @@
1
1
  module BabySqueel
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
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.0
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 00:00:00.000000000 Z
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.6.8
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.