store_base_sti_class 0.1.0 → 0.2.0
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 +7 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +1 -0
- data/VERSION +1 -1
- data/db/storebasestiname_unittest.sql +0 -0
- data/gemfiles/rails_4.1.0.gemfile +10 -0
- data/gemfiles/rails_4.1.0.gemfile.lock +81 -0
- data/lib/store_base_sti_class.rb +3 -1
- data/lib/store_base_sti_class_for_4_0.rb +1 -1
- data/lib/store_base_sti_class_for_4_1.rb +351 -0
- data/store_base_sti_class.gemspec +12 -5
- metadata +36 -34
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8223d210369cfbaa74f8f4f75bc792e6a17d3833
|
4
|
+
data.tar.gz: 4868fd15abcdcbd37a82fcbbeb5b0bccd6e6fced
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f7f95896a2a50d03aed6270c86556366135832645afa62401ec4d03d96597d6e1314e9cded000138c0739af1f42e5a40782f8d036d9f5bd70840d10da1423f8f
|
7
|
+
data.tar.gz: 9b7009d9864e1317276322be0c1f01155d9239bf5b764bb6e11e92a707e674745636c7b5d8e85c7251602b5e7436aebcecbcb685e8e0f7fff72af45168a1b858
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "sqlite3", :group=>:development
|
6
|
+
gem "appraisal", :group=>:development
|
7
|
+
gem "jeweler", :group=>:development
|
8
|
+
gem "bundler", :group=>:development
|
9
|
+
gem "activerecord", "4.1.0"
|
10
|
+
|
@@ -0,0 +1,81 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (4.0.1)
|
5
|
+
activesupport (= 4.0.1)
|
6
|
+
builder (~> 3.1.0)
|
7
|
+
activerecord (4.0.1)
|
8
|
+
activemodel (= 4.0.1)
|
9
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
10
|
+
activesupport (= 4.0.1)
|
11
|
+
arel (~> 4.0.0)
|
12
|
+
activerecord-deprecated_finders (1.0.3)
|
13
|
+
activesupport (4.0.1)
|
14
|
+
i18n (~> 0.6, >= 0.6.4)
|
15
|
+
minitest (~> 4.2)
|
16
|
+
multi_json (~> 1.3)
|
17
|
+
thread_safe (~> 0.1)
|
18
|
+
tzinfo (~> 0.3.37)
|
19
|
+
addressable (2.3.5)
|
20
|
+
appraisal (0.5.2)
|
21
|
+
bundler
|
22
|
+
rake
|
23
|
+
arel (4.0.1)
|
24
|
+
atomic (1.1.14)
|
25
|
+
builder (3.1.4)
|
26
|
+
faraday (0.8.8)
|
27
|
+
multipart-post (~> 1.2.0)
|
28
|
+
git (1.2.6)
|
29
|
+
github_api (0.10.1)
|
30
|
+
addressable
|
31
|
+
faraday (~> 0.8.1)
|
32
|
+
hashie (>= 1.2)
|
33
|
+
multi_json (~> 1.4)
|
34
|
+
nokogiri (~> 1.5.2)
|
35
|
+
oauth2
|
36
|
+
hashie (2.0.5)
|
37
|
+
highline (1.6.20)
|
38
|
+
httpauth (0.2.0)
|
39
|
+
i18n (0.6.5)
|
40
|
+
jeweler (1.8.8)
|
41
|
+
builder
|
42
|
+
bundler (~> 1.0)
|
43
|
+
git (>= 1.2.5)
|
44
|
+
github_api (= 0.10.1)
|
45
|
+
highline (>= 1.6.15)
|
46
|
+
nokogiri (= 1.5.10)
|
47
|
+
rake
|
48
|
+
rdoc
|
49
|
+
json (1.8.1)
|
50
|
+
jwt (0.1.8)
|
51
|
+
multi_json (>= 1.5)
|
52
|
+
minitest (4.7.5)
|
53
|
+
multi_json (1.8.2)
|
54
|
+
multi_xml (0.5.5)
|
55
|
+
multipart-post (1.2.0)
|
56
|
+
nokogiri (1.5.10)
|
57
|
+
oauth2 (0.9.2)
|
58
|
+
faraday (~> 0.8)
|
59
|
+
httpauth (~> 0.2)
|
60
|
+
jwt (~> 0.1.4)
|
61
|
+
multi_json (~> 1.0)
|
62
|
+
multi_xml (~> 0.5)
|
63
|
+
rack (~> 1.2)
|
64
|
+
rack (1.5.2)
|
65
|
+
rake (10.1.0)
|
66
|
+
rdoc (4.0.1)
|
67
|
+
json (~> 1.4)
|
68
|
+
sqlite3 (1.3.8)
|
69
|
+
thread_safe (0.1.3)
|
70
|
+
atomic
|
71
|
+
tzinfo (0.3.38)
|
72
|
+
|
73
|
+
PLATFORMS
|
74
|
+
ruby
|
75
|
+
|
76
|
+
DEPENDENCIES
|
77
|
+
activerecord (= 4.0.1)
|
78
|
+
appraisal
|
79
|
+
bundler
|
80
|
+
jeweler
|
81
|
+
sqlite3
|
data/lib/store_base_sti_class.rb
CHANGED
@@ -4,6 +4,8 @@ if ActiveRecord::VERSION::STRING =~ /^3\.0/
|
|
4
4
|
require 'store_base_sti_class_for_3_0'
|
5
5
|
elsif ActiveRecord::VERSION::STRING =~ /^3\.(1|2)/
|
6
6
|
require 'store_base_sti_class_for_3_1_and_above'
|
7
|
-
elsif ActiveRecord::VERSION::STRING =~ /^4/
|
7
|
+
elsif ActiveRecord::VERSION::STRING =~ /^4\.0/
|
8
8
|
require 'store_base_sti_class_for_4_0'
|
9
|
+
elsif ActiveRecord::VERSION::STRING =~ /^4\.1/
|
10
|
+
require 'store_base_sti_class_for_4_1'
|
9
11
|
end
|
@@ -0,0 +1,351 @@
|
|
1
|
+
require 'active_record/associations/join_dependency/join_part'
|
2
|
+
|
3
|
+
if ActiveRecord::VERSION::STRING =~ /^4\.1/
|
4
|
+
module ActiveRecord
|
5
|
+
|
6
|
+
class Base
|
7
|
+
class_attribute :store_base_sti_class
|
8
|
+
self.store_base_sti_class = true
|
9
|
+
end
|
10
|
+
|
11
|
+
module Associations
|
12
|
+
class Association
|
13
|
+
|
14
|
+
def creation_attributes
|
15
|
+
attributes = {}
|
16
|
+
|
17
|
+
if (reflection.macro == :has_one || reflection.macro == :has_many) && !options[:through]
|
18
|
+
attributes[reflection.foreign_key] = owner[reflection.active_record_primary_key]
|
19
|
+
|
20
|
+
if reflection.options[:as]
|
21
|
+
# START PATCH
|
22
|
+
# original:
|
23
|
+
# attributes[reflection.type] = owner.class.base_class.name
|
24
|
+
|
25
|
+
attributes[reflection.type] = ActiveRecord::Base.store_base_sti_class ? owner.class.base_class.name : owner.class.name
|
26
|
+
|
27
|
+
# END PATCH
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
attributes
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
class JoinDependency # :nodoc:
|
37
|
+
class JoinAssociation < JoinPart # :nodoc:
|
38
|
+
|
39
|
+
def add_constraints(scope, owner, assoc_klass, refl, tracker)
|
40
|
+
chain = refl.chain
|
41
|
+
scope_chain = refl.scope_chain
|
42
|
+
|
43
|
+
tables = construct_tables(chain, assoc_klass, refl, tracker)
|
44
|
+
|
45
|
+
chain.each_with_index do |reflection, i|
|
46
|
+
table, foreign_table = tables.shift, tables.first
|
47
|
+
|
48
|
+
if reflection.source_macro == :belongs_to
|
49
|
+
if reflection.options[:polymorphic]
|
50
|
+
key = reflection.association_primary_key(assoc_klass)
|
51
|
+
else
|
52
|
+
key = reflection.association_primary_key
|
53
|
+
end
|
54
|
+
|
55
|
+
foreign_key = reflection.foreign_key
|
56
|
+
else
|
57
|
+
key = reflection.foreign_key
|
58
|
+
foreign_key = reflection.active_record_primary_key
|
59
|
+
end
|
60
|
+
|
61
|
+
if reflection == chain.last
|
62
|
+
bind_val = bind scope, table.table_name, key.to_s, owner[foreign_key], tracker
|
63
|
+
scope = scope.where(table[key].eq(bind_val))
|
64
|
+
|
65
|
+
if reflection.type
|
66
|
+
# START PATCH
|
67
|
+
# original: value = owner.class.base_class.name
|
68
|
+
|
69
|
+
unless ActiveRecord::Base.store_base_sti_class
|
70
|
+
value = owner.class.name
|
71
|
+
else
|
72
|
+
value = owner.class.base_class.name
|
73
|
+
end
|
74
|
+
|
75
|
+
# END PATCH
|
76
|
+
|
77
|
+
bind_val = bind scope, table.table_name, reflection.type.to_s, value, tracker
|
78
|
+
scope = scope.where(table[reflection.type].eq(bind_val))
|
79
|
+
end
|
80
|
+
else
|
81
|
+
constraint = table[key].eq(foreign_table[foreign_key])
|
82
|
+
|
83
|
+
if reflection.type
|
84
|
+
# START PATCH
|
85
|
+
# original: type = chain[i + 1].klass.base_class.name
|
86
|
+
# constraint = constraint.and(table[reflection.type].eq(type))
|
87
|
+
|
88
|
+
if ActiveRecord::Base.store_base_sti_class
|
89
|
+
type = chain[i + 1].klass.base_class.name
|
90
|
+
constraint = constraint.and(table[reflection.type].eq(type))
|
91
|
+
else
|
92
|
+
klass = chain[i + 1].klass
|
93
|
+
constraint = constraint.and(table[reflection.type].in(([klass] + klass.descendants).map(&:name)))
|
94
|
+
end
|
95
|
+
|
96
|
+
# END PATCH
|
97
|
+
end
|
98
|
+
|
99
|
+
scope = scope.joins(join(foreign_table, constraint))
|
100
|
+
end
|
101
|
+
|
102
|
+
is_first_chain = i == 0
|
103
|
+
klass = is_first_chain ? assoc_klass : reflection.klass
|
104
|
+
|
105
|
+
# Exclude the scope of the association itself, because that
|
106
|
+
# was already merged in the #scope method.
|
107
|
+
scope_chain[i].each do |scope_chain_item|
|
108
|
+
item = eval_scope(klass, scope_chain_item, owner)
|
109
|
+
|
110
|
+
if scope_chain_item == refl.scope
|
111
|
+
scope.merge! item.except(:where, :includes, :bind)
|
112
|
+
end
|
113
|
+
|
114
|
+
if is_first_chain
|
115
|
+
scope.includes! item.includes_values
|
116
|
+
end
|
117
|
+
|
118
|
+
scope.where_values += item.where_values
|
119
|
+
scope.order_values |= item.order_values
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
scope
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
class BelongsToPolymorphicAssociation < BelongsToAssociation #:nodoc:
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
def replace_keys(record)
|
134
|
+
super
|
135
|
+
|
136
|
+
# START PATCH
|
137
|
+
# original: owner[reflection.foreign_type] = record && record.class.base_class.name
|
138
|
+
|
139
|
+
unless ActiveRecord::Base.store_base_sti_class
|
140
|
+
owner[reflection.foreign_type] = record && record.class.sti_name
|
141
|
+
else
|
142
|
+
owner[reflection.foreign_type] = record && record.class.base_class.name
|
143
|
+
end
|
144
|
+
|
145
|
+
#END PATCH
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
module Associations
|
151
|
+
class Preloader
|
152
|
+
class Association
|
153
|
+
private
|
154
|
+
|
155
|
+
def build_scope
|
156
|
+
scope = klass.unscoped
|
157
|
+
|
158
|
+
values = reflection_scope.values
|
159
|
+
preload_values = preload_scope.values
|
160
|
+
|
161
|
+
scope.where_values = Array(values[:where]) + Array(preload_values[:where])
|
162
|
+
scope.references_values = Array(values[:references]) + Array(preload_values[:references])
|
163
|
+
|
164
|
+
scope.select! preload_values[:select] || values[:select] || table[Arel.star]
|
165
|
+
scope.includes! preload_values[:includes] || values[:includes]
|
166
|
+
|
167
|
+
if options[:as]
|
168
|
+
scope.where!(klass.table_name => {
|
169
|
+
|
170
|
+
#START PATCH
|
171
|
+
#original: reflection.type => model.base_class.sti_name
|
172
|
+
|
173
|
+
reflection.type => ActiveRecord::Base.store_base_sti_class ? model.base_class.sti_name : model.sti_name
|
174
|
+
|
175
|
+
#END PATCH
|
176
|
+
})
|
177
|
+
end
|
178
|
+
|
179
|
+
scope
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
module ThroughAssociation
|
184
|
+
def through_scope
|
185
|
+
through_scope = through_reflection.klass.unscoped
|
186
|
+
|
187
|
+
if options[:source_type]
|
188
|
+
#START PATCH
|
189
|
+
#original: through_scope.where! reflection.foreign_type => options[:source_type]
|
190
|
+
|
191
|
+
through_scope.where! reflection.foreign_type => ([options[:source_type].constantize] + options[:source_type].constantize.descendants).map(&:to_s)
|
192
|
+
|
193
|
+
#END PATCH
|
194
|
+
else
|
195
|
+
unless reflection_scope.where_values.empty?
|
196
|
+
through_scope.includes_values = Array(reflection_scope.values[:includes] || options[:source])
|
197
|
+
through_scope.where_values = reflection_scope.values[:where]
|
198
|
+
end
|
199
|
+
|
200
|
+
through_scope.references! reflection_scope.values[:references]
|
201
|
+
through_scope.order! reflection_scope.values[:order] if through_scope.eager_loading?
|
202
|
+
end
|
203
|
+
|
204
|
+
through_scope
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
class AssociationScope
|
210
|
+
def add_constraints(scope, owner, assoc_klass, refl, tracker)
|
211
|
+
chain = refl.chain
|
212
|
+
scope_chain = refl.scope_chain
|
213
|
+
|
214
|
+
tables = construct_tables(chain, assoc_klass, refl, tracker)
|
215
|
+
|
216
|
+
chain.each_with_index do |reflection, i|
|
217
|
+
table, foreign_table = tables.shift, tables.first
|
218
|
+
|
219
|
+
if reflection.source_macro == :has_and_belongs_to_many
|
220
|
+
join_table = tables.shift
|
221
|
+
|
222
|
+
scope = scope.joins(join(
|
223
|
+
join_table,
|
224
|
+
table[reflection.association_primary_key].
|
225
|
+
eq(join_table[reflection.association_foreign_key])
|
226
|
+
))
|
227
|
+
|
228
|
+
table, foreign_table = join_table, tables.first
|
229
|
+
end
|
230
|
+
|
231
|
+
if reflection.source_macro == :belongs_to
|
232
|
+
if reflection.options[:polymorphic]
|
233
|
+
key = reflection.association_primary_key(assoc_klass)
|
234
|
+
else
|
235
|
+
key = reflection.association_primary_key
|
236
|
+
end
|
237
|
+
|
238
|
+
foreign_key = reflection.foreign_key
|
239
|
+
else
|
240
|
+
key = reflection.foreign_key
|
241
|
+
foreign_key = reflection.active_record_primary_key
|
242
|
+
end
|
243
|
+
|
244
|
+
if reflection == chain.last
|
245
|
+
bind_val = bind scope, table.table_name, key.to_s, owner[foreign_key], tracker
|
246
|
+
scope = scope.where(table[key].eq(bind_val))
|
247
|
+
|
248
|
+
if reflection.type
|
249
|
+
# # START PATCH
|
250
|
+
# # original: value = owner.class.base_class.name
|
251
|
+
|
252
|
+
unless ActiveRecord::Base.store_base_sti_class
|
253
|
+
value = owner.class.name
|
254
|
+
else
|
255
|
+
value = owner.class.base_class.name
|
256
|
+
end
|
257
|
+
|
258
|
+
# END PATCH
|
259
|
+
bind_val = bind scope, table.table_name, reflection.type.to_s, value, tracker
|
260
|
+
scope = scope.where(table[reflection.type].eq(bind_val))
|
261
|
+
end
|
262
|
+
else
|
263
|
+
constraint = table[key].eq(foreign_table[foreign_key])
|
264
|
+
|
265
|
+
if reflection.type
|
266
|
+
# START PATCH
|
267
|
+
# original: type = chain[i + 1].klass.base_class.name
|
268
|
+
# constraint = constraint.and(table[reflection.type].eq(type))
|
269
|
+
|
270
|
+
if ActiveRecord::Base.store_base_sti_class
|
271
|
+
type = chain[i + 1].klass.base_class.name
|
272
|
+
constraint = constraint.and(table[reflection.type].eq(type))
|
273
|
+
else
|
274
|
+
klass = chain[i + 1].klass
|
275
|
+
constraint = constraint.and(table[reflection.type].in(([klass] + klass.descendants).map(&:name)))
|
276
|
+
end
|
277
|
+
|
278
|
+
bind_val = bind scope, table.table_name, reflection.type.to_s, value, tracker
|
279
|
+
scope = scope.where(table[reflection.type].eq(bind_val))
|
280
|
+
# END PATCH
|
281
|
+
end
|
282
|
+
|
283
|
+
scope = scope.joins(join(foreign_table, constraint))
|
284
|
+
end
|
285
|
+
|
286
|
+
is_first_chain = i == 0
|
287
|
+
klass = is_first_chain ? assoc_klass : reflection.klass
|
288
|
+
|
289
|
+
# Exclude the scope of the association itself, because that
|
290
|
+
# was already merged in the #scope method.
|
291
|
+
scope_chain[i].each do |scope_chain_item|
|
292
|
+
item = eval_scope(klass, scope_chain_item, owner)
|
293
|
+
|
294
|
+
if scope_chain_item == refl.scope
|
295
|
+
scope.merge! item.except(:where, :includes, :bind)
|
296
|
+
end
|
297
|
+
|
298
|
+
if is_first_chain
|
299
|
+
scope.includes! item.includes_values
|
300
|
+
end
|
301
|
+
|
302
|
+
scope.where_values += item.where_values
|
303
|
+
scope.order_values |= item.order_values
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
scope
|
308
|
+
end
|
309
|
+
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
module Reflection
|
314
|
+
class ThroughReflection < AssociationReflection
|
315
|
+
|
316
|
+
def scope_chain
|
317
|
+
@scope_chain ||= begin
|
318
|
+
scope_chain = source_reflection.scope_chain.map(&:dup)
|
319
|
+
|
320
|
+
# Add to it the scope from this reflection (if any)
|
321
|
+
scope_chain.first << scope if scope
|
322
|
+
|
323
|
+
through_scope_chain = through_reflection.scope_chain.map(&:dup)
|
324
|
+
|
325
|
+
if options[:source_type]
|
326
|
+
# START PATCH
|
327
|
+
# original:
|
328
|
+
# through_scope_chain.first <<
|
329
|
+
# through_reflection.klass.where(foreign_type => options[:source_type])
|
330
|
+
|
331
|
+
unless ActiveRecord::Base.store_base_sti_class
|
332
|
+
through_scope_chain.first <<
|
333
|
+
through_reflection.klass.where(foreign_type => ([options[:source_type].constantize] + options[:source_type].constantize.descendants).map(&:to_s))
|
334
|
+
else
|
335
|
+
through_scope_chain.first <<
|
336
|
+
through_reflection.klass.where(foreign_type => options[:source_type])
|
337
|
+
end
|
338
|
+
|
339
|
+
# END PATCH
|
340
|
+
end
|
341
|
+
|
342
|
+
# Recursively fill out the rest of the array from the through reflection
|
343
|
+
scope_chain + through_scope_chain
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
end
|
350
|
+
|
351
|
+
end
|
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: store_base_sti_class 0.2.0 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "store_base_sti_class"
|
8
|
-
s.version = "0.
|
9
|
+
s.version = "0.2.0"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Andrew Mutz"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2014-08-03"
|
13
15
|
s.description = "\n ActiveRecord has always stored the base class in polymorphic _type columns when using STI. This can have non-trivial\n performance implications in certain cases. This gem adds 'store_base_sti_class' configuration options which controls\n whether ActiveRecord will store the base class or the actual class. Default to true for backwards compatibility.\n "
|
14
16
|
s.email = "andrew.mutz@appfolio.com"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -110,10 +112,13 @@ Gem::Specification.new do |s|
|
|
110
112
|
"gemfiles/rails_4.0.0.gemfile.lock",
|
111
113
|
"gemfiles/rails_4.0.1.gemfile",
|
112
114
|
"gemfiles/rails_4.0.1.gemfile.lock",
|
115
|
+
"gemfiles/rails_4.1.0.gemfile",
|
116
|
+
"gemfiles/rails_4.1.0.gemfile.lock",
|
113
117
|
"lib/store_base_sti_class.rb",
|
114
118
|
"lib/store_base_sti_class_for_3_0.rb",
|
115
119
|
"lib/store_base_sti_class_for_3_1_and_above.rb",
|
116
120
|
"lib/store_base_sti_class_for_4_0.rb",
|
121
|
+
"lib/store_base_sti_class_for_4_1.rb",
|
117
122
|
"store_base_sti_class.gemspec",
|
118
123
|
"test/connection.rb",
|
119
124
|
"test/helper.rb",
|
@@ -123,21 +128,22 @@ Gem::Specification.new do |s|
|
|
123
128
|
]
|
124
129
|
s.homepage = "http://github.com/appfolio/store_base_sti_class"
|
125
130
|
s.licenses = ["MIT"]
|
126
|
-
s.
|
127
|
-
s.rubygems_version = "1.8.23"
|
131
|
+
s.rubygems_version = "2.2.0"
|
128
132
|
s.summary = "Modifies ActiveRecord 3.0.5 - 4.0.1 with the ability to store the actual class (instead of the base class) in polymorhic _type columns when using STI"
|
129
133
|
|
130
134
|
if s.respond_to? :specification_version then
|
131
|
-
s.specification_version =
|
135
|
+
s.specification_version = 4
|
132
136
|
|
133
137
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
134
138
|
s.add_runtime_dependency(%q<activerecord>, [">= 0"])
|
139
|
+
s.add_runtime_dependency(%q<minitest>, ["~> 4.0"])
|
135
140
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
136
141
|
s.add_development_dependency(%q<appraisal>, [">= 0"])
|
137
142
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
138
143
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
139
144
|
else
|
140
145
|
s.add_dependency(%q<activerecord>, [">= 0"])
|
146
|
+
s.add_dependency(%q<minitest>, ["~> 4.0"])
|
141
147
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
142
148
|
s.add_dependency(%q<appraisal>, [">= 0"])
|
143
149
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
@@ -145,6 +151,7 @@ Gem::Specification.new do |s|
|
|
145
151
|
end
|
146
152
|
else
|
147
153
|
s.add_dependency(%q<activerecord>, [">= 0"])
|
154
|
+
s.add_dependency(%q<minitest>, ["~> 4.0"])
|
148
155
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
149
156
|
s.add_dependency(%q<appraisal>, [">= 0"])
|
150
157
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
metadata
CHANGED
@@ -1,98 +1,101 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: store_base_sti_class
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andrew Mutz
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.0'
|
30
41
|
- !ruby/object:Gem::Dependency
|
31
42
|
name: sqlite3
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
44
|
requirements:
|
35
|
-
- -
|
45
|
+
- - ">="
|
36
46
|
- !ruby/object:Gem::Version
|
37
47
|
version: '0'
|
38
48
|
type: :development
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
51
|
requirements:
|
43
|
-
- -
|
52
|
+
- - ">="
|
44
53
|
- !ruby/object:Gem::Version
|
45
54
|
version: '0'
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: appraisal
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
|
-
- -
|
59
|
+
- - ">="
|
52
60
|
- !ruby/object:Gem::Version
|
53
61
|
version: '0'
|
54
62
|
type: :development
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
|
-
- -
|
66
|
+
- - ">="
|
60
67
|
- !ruby/object:Gem::Version
|
61
68
|
version: '0'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: jeweler
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
|
-
- -
|
73
|
+
- - ">="
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: '0'
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- -
|
80
|
+
- - ">="
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: '0'
|
78
83
|
- !ruby/object:Gem::Dependency
|
79
84
|
name: bundler
|
80
85
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
86
|
requirements:
|
83
|
-
- -
|
87
|
+
- - ">="
|
84
88
|
- !ruby/object:Gem::Version
|
85
89
|
version: '0'
|
86
90
|
type: :development
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
93
|
requirements:
|
91
|
-
- -
|
94
|
+
- - ">="
|
92
95
|
- !ruby/object:Gem::Version
|
93
96
|
version: '0'
|
94
|
-
description:
|
95
|
-
|
97
|
+
description: "\n ActiveRecord has always stored the base class in polymorphic _type
|
98
|
+
columns when using STI. This can have non-trivial\n performance implications
|
96
99
|
in certain cases. This gem adds 'store_base_sti_class' configuration options which
|
97
100
|
controls\n whether ActiveRecord will store the base class or the actual class.
|
98
101
|
Default to true for backwards compatibility.\n "
|
@@ -196,10 +199,13 @@ files:
|
|
196
199
|
- gemfiles/rails_4.0.0.gemfile.lock
|
197
200
|
- gemfiles/rails_4.0.1.gemfile
|
198
201
|
- gemfiles/rails_4.0.1.gemfile.lock
|
202
|
+
- gemfiles/rails_4.1.0.gemfile
|
203
|
+
- gemfiles/rails_4.1.0.gemfile.lock
|
199
204
|
- lib/store_base_sti_class.rb
|
200
205
|
- lib/store_base_sti_class_for_3_0.rb
|
201
206
|
- lib/store_base_sti_class_for_3_1_and_above.rb
|
202
207
|
- lib/store_base_sti_class_for_4_0.rb
|
208
|
+
- lib/store_base_sti_class_for_4_1.rb
|
203
209
|
- store_base_sti_class.gemspec
|
204
210
|
- test/connection.rb
|
205
211
|
- test/helper.rb
|
@@ -209,30 +215,26 @@ files:
|
|
209
215
|
homepage: http://github.com/appfolio/store_base_sti_class
|
210
216
|
licenses:
|
211
217
|
- MIT
|
218
|
+
metadata: {}
|
212
219
|
post_install_message:
|
213
220
|
rdoc_options: []
|
214
221
|
require_paths:
|
215
222
|
- lib
|
216
223
|
required_ruby_version: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
224
|
requirements:
|
219
|
-
- -
|
225
|
+
- - ">="
|
220
226
|
- !ruby/object:Gem::Version
|
221
227
|
version: '0'
|
222
|
-
segments:
|
223
|
-
- 0
|
224
|
-
hash: 183579664896740947
|
225
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
|
-
none: false
|
227
229
|
requirements:
|
228
|
-
- -
|
230
|
+
- - ">="
|
229
231
|
- !ruby/object:Gem::Version
|
230
232
|
version: '0'
|
231
233
|
requirements: []
|
232
234
|
rubyforge_project:
|
233
|
-
rubygems_version:
|
235
|
+
rubygems_version: 2.2.0
|
234
236
|
signing_key:
|
235
|
-
specification_version:
|
237
|
+
specification_version: 4
|
236
238
|
summary: Modifies ActiveRecord 3.0.5 - 4.0.1 with the ability to store the actual
|
237
239
|
class (instead of the base class) in polymorhic _type columns when using STI
|
238
240
|
test_files: []
|