270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
# File 'lib/store_base_sti_class_for_3_1.rb', line 270
def conditions
@conditions ||= begin
conditions = source_reflection.conditions.map { |c| c.dup }
conditions.first << options[:conditions] if options[:conditions]
through_conditions = through_reflection.conditions
if options[:source_type]
unless ActiveRecord::Base.store_base_sti_class
through_conditions.first << { foreign_type => ([options[:source_type].constantize] + options[:source_type].constantize.descendants).map(&:to_s) }
else
through_conditions.first << { foreign_type => options[:source_type] }
end
end
conditions += through_conditions
conditions
end
end
|