belongs_to not working as expected

I'm using ActiveRecord 2.3.2. I have a class with a belongs_to
association like this:

  class Foo < ActiveRecord::Base
    belongs_to :bar

It is valid for bar to be nil (thus, in the database, foos.bar_id can
be null). However, if I execute the following I get an error:

  foo = # => nil! # expect nil but get error

The full error message is, "ActiveRecord::RecordNotFound (Couldn't
find Bar without an ID)". Tracing the code I see that
ActiveRecord::Base.find_from_ids(ids, options) is being called by
passing an array containing a single, nil, element for the ids
argument. Here is the method:

  def find_from_ids(ids, options)
    expects_array = ids.first.kind_of?(Array)
    return ids.first if expects_array && ids.first.empty?

    ids = ids.flatten.compact.uniq

    case ids.size
      when 0
        raise RecordNotFound, "Couldn't find #{name} without an ID"
      when 1
        result = find_one(ids.first, options)
        expects_array ? [ result ] : result
        find_some(ids, options)

Without delving further to assess other consequences, it seems to me
that either nil should be returned when ids.size == 0 or the line "ids
= ids.flatten.compact.uniq" should be replaced with:

  ids = ids.flatten.uniq
  return nil if ids.length == 1 && ids.first.nil?

Any thoughts gratefully received!