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:
Xavier Noria
2010-03-12 20:23:39 +01:00
committed by Jeremy Kemper
parent 611744ebd3
commit fe43bbd8c7
2 changed files with 2 additions and 1 deletions

View File

@@ -101,6 +101,7 @@ module ActiveRecord
Array(@target)
end
end
alias_method :to_a, :to_ary
def reset
reset_target!

View File

@@ -49,7 +49,7 @@ module ActiveRecord
alias_method :proxy_respond_to?, :respond_to?
alias_method :proxy_extend, :extend
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)
@owner, @reflection = owner, reflection