has_one association problem together with Object method override

Hi,

I came across a peculiar problem with has_one association in
combination with an Object method override. Can somebody explain to me
what is going on?

Here is how it goes:

I have a 'has_one' relationship between Supplier and Account, like in
the example of the has_one example used in Rails Guides.

Supplier:

class Supplier < ActiveRecord::Base

  validates :name, :presence => true

  has_one :account

  nilify_blanks
end

Account:

class Account < ActiveRecord::Base

  belongs_to :supplier

  validates :supplier_id, :presence => true

  nilify_blanks

  def foo
    puts 'in account'
  end

  def to_s
    puts 'in account'
  end

end

I also have a method foo on Object as follows:

class Object
  def foo
    puts 'in object'
  end
end

When I call:

Supplier#account#to_s I get 'in account'

When I call:

Supplier#account#foo I get 'in object'

whereas I would expect it to print 'in account'

Does anybody have any clue why does this happen? Is this a bug in
Rails ActiveRecord?

Thanks in advance
P.S. If you want, you can get a full fledged application that
demonstrates the problem from here:

git://github.com/pmatsinopoulos/test_association_and_object_method_override.git