store_base_sti_class 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +4 -3
- data/gemfiles/{rails_5.2.2.gemfile → rails_5.2.3.gemfile} +1 -1
- data/gemfiles/rails_5.2.4.gemfile +8 -0
- data/gemfiles/{rails_6.0.0.gemfile → rails_6.0.1.gemfile} +1 -1
- data/lib/store_base_sti_class/version.rb +1 -1
- data/lib/store_base_sti_class_for_5_2.rb +34 -13
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d905b8e881303f37a959af003a8ae10b9a8c47d936a6adb9afc75bf149dbbd68
|
4
|
+
data.tar.gz: 53baeb1bf2222de935343215b1bfa036d3cbd4c26ae6087ead371e0918e11754
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 285c2c32254eb69039e4cc5337065dcde7f1a99f65fdc6902e1027e6dbd380a36bd488ae87c0e5b2c718d463ce0f4a5fb82f1993246bab4f7ccee0ca2914c2ab
|
7
|
+
data.tar.gz: 9be85dd36e7ed71a298d95dc434940e73a05de94d798d21cf46d9b805a683129272ee07688e684c056a46bc7ce9321e06a6f2ece71f2f4219eeab11f902ef1f9
|
data/Appraisals
CHANGED
@@ -2,13 +2,14 @@ RAILS_VERSIONS = %w[
|
|
2
2
|
4.2.11
|
3
3
|
5.0.7
|
4
4
|
5.1.6
|
5
|
-
5.2.
|
6
|
-
|
5
|
+
5.2.3
|
6
|
+
5.2.4
|
7
|
+
6.0.1
|
7
8
|
].freeze
|
8
9
|
|
9
10
|
RAILS_VERSIONS.each do |version|
|
10
11
|
appraise "rails_#{version}" do
|
11
12
|
gem 'activerecord', version
|
12
|
-
gem 'sqlite3', version == '6.0.
|
13
|
+
gem 'sqlite3', version == '6.0.1' ? '~> 1.4.0' : '~> 1.3.0'
|
13
14
|
end
|
14
15
|
end
|
@@ -110,22 +110,43 @@ if ActiveRecord::VERSION::STRING =~ /^5\.2/
|
|
110
110
|
class HasManyThroughAssociation
|
111
111
|
private
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
if
|
123
|
-
|
113
|
+
if ActiveRecord::VERSION::STRING =~ /^5\.2\.4/
|
114
|
+
def build_through_record(record)
|
115
|
+
@through_records[record.object_id] ||= begin
|
116
|
+
ensure_mutable
|
117
|
+
|
118
|
+
attributes = through_scope_attributes
|
119
|
+
attributes[source_reflection.name] = record
|
120
|
+
|
121
|
+
# START PATCH
|
122
|
+
if ActiveRecord::Base.store_base_sti_class
|
123
|
+
if options[:source_type]
|
124
|
+
attributes[source_reflection.foreign_type] = options[:source_type]
|
125
|
+
end
|
124
126
|
end
|
127
|
+
# END PATCH
|
128
|
+
|
129
|
+
through_association.build(attributes)
|
125
130
|
end
|
126
|
-
|
131
|
+
end
|
132
|
+
else
|
133
|
+
def build_through_record(record)
|
134
|
+
@through_records[record.object_id] ||= begin
|
135
|
+
ensure_mutable
|
136
|
+
|
137
|
+
through_record = through_association.build(*options_for_through_record)
|
138
|
+
through_record.send("#{source_reflection.name}=", record)
|
139
|
+
|
140
|
+
# START PATCH
|
141
|
+
if ActiveRecord::Base.store_base_sti_class
|
142
|
+
if options[:source_type]
|
143
|
+
through_record.send("#{source_reflection.foreign_type}=", options[:source_type])
|
144
|
+
end
|
145
|
+
end
|
146
|
+
# END PATCH
|
127
147
|
|
128
|
-
|
148
|
+
through_record
|
149
|
+
end
|
129
150
|
end
|
130
151
|
end
|
131
152
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: store_base_sti_class
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AppFolio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -87,8 +87,9 @@ files:
|
|
87
87
|
- gemfiles/rails_4.2.11.gemfile
|
88
88
|
- gemfiles/rails_5.0.7.gemfile
|
89
89
|
- gemfiles/rails_5.1.6.gemfile
|
90
|
-
- gemfiles/rails_5.2.
|
91
|
-
- gemfiles/
|
90
|
+
- gemfiles/rails_5.2.3.gemfile
|
91
|
+
- gemfiles/rails_5.2.4.gemfile
|
92
|
+
- gemfiles/rails_6.0.1.gemfile
|
92
93
|
- lib/store_base_sti_class.rb
|
93
94
|
- lib/store_base_sti_class/version.rb
|
94
95
|
- lib/store_base_sti_class_for_4_2.rb
|