active_record-mti 0.3.0.pre.rc4 → 0.3.2
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 +5 -5
- data/.travis.yml +0 -5
- data/CHANGELOG.md +6 -1
- data/Gemfile +2 -0
- data/active_record-mti.gemspec +1 -1
- data/lib/active_record/mti/query_methods.rb +12 -9
- data/lib/active_record/mti/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 781df2afedf44dd2bdcc4014d8d2e165ebea29eaccea9360573941df5a937ef4
|
4
|
+
data.tar.gz: 544c4507ae2c1bbc25b59414b97579ac5cfe52b2c449fe7739ee17366bc76866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e70e8399e5c11b8b8d33fb914debaa072e5e9c7fad8e99aea01385426460a8d461e807be2b7dcea9a8d9aac3108607ad8c3ce17f2bcaacd295ab71b0487451f8
|
7
|
+
data.tar.gz: f51d31db93ba3c77d026eb673b4315e7e2d927584505eaea7c28e855aaf6978302ad2b05ec9dacd225cd5802bfbe46119033edc70cb7d65018e7c86c7dc12a0a
|
data/.travis.yml
CHANGED
@@ -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
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# ActiveRecord::MTI
|
2
2
|
|
3
|
-
## 0.3.
|
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
data/active_record-mti.gemspec
CHANGED
@@ -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.
|
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)
|
7
|
-
group_by_tableoid = group_values.delete(:tableoid)
|
6
|
+
@select_by_tableoid = [select_values.delete(:tableoid), tableoid?(klass)].compact.first
|
7
|
+
@group_by_tableoid = group_values.delete(:tableoid)
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
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.
|
27
|
+
klass.mti_type_column
|
25
28
|
end
|
26
29
|
|
27
30
|
def tableoid_project(klass)
|
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.
|
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:
|
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.
|
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:
|
176
|
+
version: '0'
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.
|
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
|