Skip to content

Commit

Permalink
keep AssociationProxy#to_a to avoid warning in Array(post.author), an…
Browse files Browse the repository at this point in the history
…d delegate it to @target in association collections

[#4165 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information
fxn authored and jeremy committed Mar 12, 2010
1 parent 611744e commit fe43bbd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Expand Up @@ -101,6 +101,7 @@ def to_ary
Array(@target) Array(@target)
end end
end end
alias_method :to_a, :to_ary


def reset def reset
reset_target! reset_target!
Expand Down
Expand Up @@ -49,7 +49,7 @@ class AssociationProxy #:nodoc:
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
Expand Down

0 comments on commit fe43bbd

Please sign in to comment.