mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fix private methods which are delegated to. This previously worked because Module#delegate previously ignored method visibility.
This commit is contained in:
@@ -151,20 +151,20 @@ module ActiveRecord
|
||||
reset
|
||||
end
|
||||
|
||||
def interpolate(sql, record = nil)
|
||||
if sql.respond_to?(:to_proc)
|
||||
owner.send(:instance_exec, record, &sql)
|
||||
else
|
||||
sql
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_target?
|
||||
!loaded? && (!owner.new_record? || foreign_key_present?) && klass
|
||||
end
|
||||
|
||||
def interpolate(sql, record = nil)
|
||||
if sql.respond_to?(:to_proc)
|
||||
owner.send(:instance_exec, record, &sql)
|
||||
else
|
||||
sql
|
||||
end
|
||||
end
|
||||
|
||||
def creation_attributes
|
||||
attributes = {}
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@ module ActiveRecord
|
||||
# = Active Record Belongs To Polymorphic Association
|
||||
module Associations
|
||||
class BelongsToPolymorphicAssociation < BelongsToAssociation #:nodoc:
|
||||
def klass
|
||||
type = owner[reflection.foreign_type]
|
||||
type.presence && type.constantize
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def replace_keys(record)
|
||||
@@ -17,11 +22,6 @@ module ActiveRecord
|
||||
reflection.polymorphic_inverse_of(record.class)
|
||||
end
|
||||
|
||||
def klass
|
||||
type = owner[reflection.foreign_type]
|
||||
type.presence && type.constantize
|
||||
end
|
||||
|
||||
def raise_on_type_mismatch(record)
|
||||
# A polymorphic association cannot have a type mismatch, by definition
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user