active_record-mti 0.3.0.pre.rc4 → 0.3.2

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
- SHA1:
3
- metadata.gz: c09a0c6a54ac017046879c831b9d38c9b8537814
4
- data.tar.gz: 583b53b0da0582fc7edc5498370eb652d3504281
2
+ SHA256:
3
+ metadata.gz: 781df2afedf44dd2bdcc4014d8d2e165ebea29eaccea9360573941df5a937ef4
4
+ data.tar.gz: 544c4507ae2c1bbc25b59414b97579ac5cfe52b2c449fe7739ee17366bc76866
5
5
  SHA512:
6
- metadata.gz: a944519cc3c24d2119437c8161fb9f9b178cd9bb4a999baa2ae9b2956e73191b93e4bb148bbdd0adc7512b06d5b91a58bc2114ea5e0f819109c91b5c6c0a7fc8
7
- data.tar.gz: 217552288c9020c9251634261e7634c7641f141a2bb059ff2488858ef015682828c55d5bb12e990fa84aee24ba611d81963fb1660404a087c200513428683475
6
+ metadata.gz: e70e8399e5c11b8b8d33fb914debaa072e5e9c7fad8e99aea01385426460a8d461e807be2b7dcea9a8d9aac3108607ad8c3ce17f2bcaacd295ab71b0487451f8
7
+ data.tar.gz: f51d31db93ba3c77d026eb673b4315e7e2d927584505eaea7c28e855aaf6978302ad2b05ec9dacd225cd5802bfbe46119033edc70cb7d65018e7c86c7dc12a0a
@@ -16,7 +16,6 @@ rvm:
16
16
  - 2.3
17
17
  - 2.2
18
18
  - 2.1
19
- - 2.0
20
19
 
21
20
  gemfile:
22
21
  - gemfiles/activerecord-5.1.Gemfile
@@ -27,10 +26,6 @@ gemfile:
27
26
 
28
27
  matrix:
29
28
  exclude:
30
- - rvm: 2.0
31
- gemfile: gemfiles/activerecord-5.0.Gemfile
32
- - rvm: 2.0
33
- gemfile: gemfiles/activerecord-5.1.Gemfile
34
29
 
35
30
  - rvm: 2.1
36
31
  gemfile: gemfiles/activerecord-5.0.Gemfile
@@ -1,8 +1,13 @@
1
1
  # ActiveRecord::MTI
2
2
 
3
- ## 0.3.0 _(Unreleased)_
3
+ ## 0.3.2 _(July 15th 2018)_
4
+ - 0.3.1 Yanked due to failing specs in spec matrix
5
+ - Fixed issue causing fails
6
+
7
+ ## 0.3.1 ~_(July 15th 2018)_~ YANKED
4
8
  - Greatly improved future-proofing injection strategy.
5
9
  - No longer overwriting (and maintaining) ActiveRecord Calculation sub-routines.
10
+ - Improve order of grouping and projection so other gems have more information to work with. (Like [`DeletedAt`](https://github.com/TwilightCoders/deleted_at))
6
11
  - Instead of injecting at `build_select`, we're injecting at `build_arel` with one additional new sub-routine (`build_mti`)
7
12
  - `build_mti` sub-routine detects if an MTI projection is needed based on grouping and selecting from query being built.
8
13
  - No longer need to use `uses_mti`
data/Gemfile CHANGED
@@ -4,6 +4,8 @@ gemspec
4
4
 
5
5
  group :test do
6
6
 
7
+ gem 'pry'
8
+
7
9
  # Generates coverage stats of specs
8
10
  gem 'simplecov'
9
11
 
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ['lib', 'spec']
30
30
 
31
31
  rails_versions = ['>= 4', '< 6']
32
- spec.required_ruby_version = '>= 2.0'
32
+ spec.required_ruby_version = '>= 2.1'
33
33
 
34
34
  spec.add_runtime_dependency 'pg', '~> 0'
35
35
  spec.add_runtime_dependency 'activerecord', rails_versions
@@ -3,17 +3,20 @@ module ActiveRecord
3
3
  module QueryMethods
4
4
 
5
5
  def build_arel
6
- select_by_tableoid = select_values.delete(:tableoid) == :tableoid
7
- group_by_tableoid = group_values.delete(:tableoid) == :tableoid
6
+ @select_by_tableoid = [select_values.delete(:tableoid), tableoid?(klass)].compact.first
7
+ @group_by_tableoid = group_values.delete(:tableoid)
8
8
 
9
- arel = super
10
-
11
- if tableoid?(@klass) || group_by_tableoid || select_by_tableoid
12
- arel.project(tableoid_project(@klass))
13
- arel.group(tableoid_group(@klass)) if group_values.any? || group_by_tableoid
9
+ super.tap do |arel|
10
+ if @group_by_tableoid || (@select_by_tableoid && group_values.any?)
11
+ arel.group(tableoid_group(@klass))
12
+ end
14
13
  end
14
+ end
15
15
 
16
- arel
16
+ def build_select(*args)
17
+ super.tap do |arel|
18
+ arel.project(tableoid_project(@klass)) if (@group_by_tableoid || @select_by_tableoid)
19
+ end
17
20
  end
18
21
 
19
22
  private
@@ -21,7 +24,7 @@ module ActiveRecord
21
24
  def tableoid?(klass)
22
25
  !Thread.current['skip_tableoid_cast'] &&
23
26
  klass.using_multi_table_inheritance? &&
24
- klass.has_tableoid_column?
27
+ klass.mti_type_column
25
28
  end
26
29
 
27
30
  def tableoid_project(klass)
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module MTI
3
- VERSION = '0.3.0-rc4'
3
+ VERSION = '0.3.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-mti
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.pre.rc4
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Stevens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-15 00:00:00.000000000 Z
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -168,15 +168,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - ">="
170
170
  - !ruby/object:Gem::Version
171
- version: '2.0'
171
+ version: '2.1'
172
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  requirements:
174
- - - ">"
174
+ - - ">="
175
175
  - !ruby/object:Gem::Version
176
- version: 1.3.1
176
+ version: '0'
177
177
  requirements: []
178
178
  rubyforge_project:
179
- rubygems_version: 2.6.13
179
+ rubygems_version: 2.7.7
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: Multi Table Inheritance for PostgreSQL in Rails