提交 fe43bbd8 编写于 作者: X Xavier Noria 提交者: Jeremy Kemper

keep AssociationProxy#to_a to avoid warning in Array(post.author), and...

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: NJeremy Kemper <jeremy@bitsweat.net>
上级 611744eb
......@@ -101,6 +101,7 @@ def to_ary
Array(@target)
end
end
alias_method :to_a, :to_ary
def reset
reset_target!
......
......@@ -49,7 +49,7 @@ class AssociationProxy #:nodoc:
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册