osx/cocoa <-> rails incompatibility

Does anyone know how to fix or even debug the following:

ActiveRecord is failing @ base.rb, line 2189:
Thread.current[:"#{self}_scoped_methods"] ||= self.default_scoping.dup

with:
"can't dup NilClass"

why default_scoping is nil is unknown.

The failure goes away if all references to
require 'osx/cocoa' are removed.

*** LOCAL GEMS ***

actionmailer (2.3.2, 1.3.6)
actionpack (2.3.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.2, 1.15.6)
activeresource (2.3.2)
activesupport (2.3.2, 1.4.4)
acts_as_ferret (0.4.3, 0.4.1)
capistrano (2.5.5, 2.0.0)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10, 1.0.9)
dnssd (0.7.1, 0.6.0)
fastthread (1.0.7, 1.0.1)
fcgi (0.8.7)
ferret (0.11.6, 0.11.4)
gem_plugin (0.2.3)
gnuplot (2.2)
gruff (0.3.4)
highline (1.5.1, 1.2.9)
hpricot (0.8.1, 0.6)
libxml-ruby (1.1.3, 0.9.5, 0.3.8.4)
mongrel (1.1.5, 1.1.4)
mysql (2.7)
needle (1.3.0)
net-scp (1.0.2)
net-sftp (2.0.2, 1.1.0)
net-ssh (2.0.11, 1.1.2)
net-ssh-gateway (1.0.1)
rails (2.3.2, 1.2.6)
rake (0.8.6, 0.7.3)
RedCloth (4.1.9, 3.0.4)
rmagick (2.9.1)
ruby-openid (2.1.6, 1.1.4)
ruby-yadis (0.3.4)
rubygems-update (1.3.3, 1.3.2)
rubynode (0.1.5, 0.1.3)
sqlite3-ruby (1.2.4, 1.2.1)
termios (0.9.4)
tlsmail (0.0.1)
tmail (1.2.3.1)

ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]

thanks in advance

I've seen this before - it's typically a sign that something has
screwed up the inherited callback for AR::Base. And a quick look at
the rubycocoa source shows this:
(in http://rubycocoa.svn.sourceforge.net/viewvc/rubycocoa/trunk/src/framework/src/ruby/osx/objc/active_record.rb?revision=2232&view=markup

class ActiveRecord::Base
  class << self
    alias_method :__inherited_before_proxy, :inherited
    def inherited(klass)
      proxy_klass = "#{klass.to_s}Proxy"
      unless klass.parent.local_constants.include?(proxy_klass)
        eval "class ::#{proxy_klass} < OSX::ActiveRecordProxy; end;"
        # FIXME: This leads to a TypeError originating from:
oc_import.rb:618:in `method_added'
        # Object.const_set(proxy_klass, Class.new
(OSX::ActiveRecordProxy))
      end
      __inherited_before_proxy(klass)
    end
  end

There's something going on, but I'm not clear why this would cause a
problem. You might do better asking on a rubycocoa list...

--Matt Jones