mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
keep AssociationProxy#to_a to avoid warning in Array(post.author), and delegate it to @target in association collections
[#4165 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
committed by
Jeremy Kemper
parent
611744ebd3
commit
fe43bbd8c7
@@ -101,6 +101,7 @@ module ActiveRecord
|
|||||||
Array(@target)
|
Array(@target)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
alias_method :to_a, :to_ary
|
||||||
|
|
||||||
def reset
|
def reset
|
||||||
reset_target!
|
reset_target!
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ module ActiveRecord
|
|||||||
alias_method :proxy_respond_to?, :respond_to?
|
alias_method :proxy_respond_to?, :respond_to?
|
||||||
alias_method :proxy_extend, :extend
|
alias_method :proxy_extend, :extend
|
||||||
delegate :to_param, :to => :proxy_target
|
delegate :to_param, :to => :proxy_target
|
||||||
instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$|proxy_|^object_id$)/ }
|
instance_methods.each { |m| undef_method m unless m =~ /^(?:nil\?|send|object_id|to_a)$|^__|proxy_/ }
|
||||||
|
|
||||||
def initialize(owner, reflection)
|
def initialize(owner, reflection)
|
||||||
@owner, @reflection = owner, reflection
|
@owner, @reflection = owner, reflection
|
||||||
|
|||||||
Reference in New Issue
Block a user