mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix private methods which are delegated to. This previously worked because Module#delegate previously ignored method visibility.
This commit is contained in:
parent
8bba95f293
commit
7b56fb034a
2 changed files with 13 additions and 13 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue