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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee6cec99ea0b5aba6ca085f1119ad70837f40502af8b248d78d466e649b66a02
4
- data.tar.gz: 6b2e0d8ba7829f225efa6eeb98fc74b30568f922bfe4664dbf8c1b060e4a3b6b
3
+ metadata.gz: d905b8e881303f37a959af003a8ae10b9a8c47d936a6adb9afc75bf149dbbd68
4
+ data.tar.gz: 53baeb1bf2222de935343215b1bfa036d3cbd4c26ae6087ead371e0918e11754
5
5
  SHA512:
6
- metadata.gz: 229854ef106a719bde09b41a71e821aa2cd69ee73877125f5fbc83a9b2fe9467e1e4b4f0d934579f7c1650ba53adbc581a4b08efe50837ef03fa42be6381e870
7
- data.tar.gz: 950d8d123ba09b1d26c88ac3601b676ba61018e24697792487bb07da21686a4ce3749c378f667f2eb69948a51b87a3631ee2308e2346012be80629188b351bb5
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.2
6
- 6.0.0
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.0' ? '~> 1.4.0' : '~> 1.3.0'
13
+ gem 'sqlite3', version == '6.0.1' ? '~> 1.4.0' : '~> 1.3.0'
13
14
  end
14
15
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "5.2.2"
5
+ gem "activerecord", "5.2.3"
6
6
  gem "sqlite3", "~> 1.3.0"
7
7
 
8
8
  gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "5.2.4"
6
+ gem "sqlite3", "~> 1.3.0"
7
+
8
+ gemspec path: "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "6.0.0"
5
+ gem "activerecord", "6.0.1"
6
6
  gem "sqlite3", "~> 1.4.0"
7
7
 
8
8
  gemspec path: "../"
@@ -1,3 +1,3 @@
1
1
  module StoreBaseSTIClass
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
@@ -110,22 +110,43 @@ if ActiveRecord::VERSION::STRING =~ /^5\.2/
110
110
  class HasManyThroughAssociation
111
111
  private
112
112
 
113
- def build_through_record(record)
114
- @through_records[record.object_id] ||= begin
115
- ensure_mutable
116
-
117
- through_record = through_association.build(*options_for_through_record)
118
- through_record.send("#{source_reflection.name}=", record)
119
-
120
- # START PATCH
121
- if ActiveRecord::Base.store_base_sti_class
122
- if options[:source_type]
123
- through_record.send("#{source_reflection.foreign_type}=", options[:source_type])
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
- # END PATCH
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
- through_record
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.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-18 00:00:00.000000000 Z
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.2.gemfile
91
- - gemfiles/rails_6.0.0.gemfile
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