Rails 2.3.2 upgrade - uninitialized constant ActiveRecord::Associations

65 views
Skip to first unread message

stewart

unread,
Jul 15, 2009, 10:17:12 PM7/15/09
to Composite Keys for ActiveRecord
Hi all,

I've recently upgraded my project from rails 2.1.2 to 2.3.2. However,
if I try and require the composite_primary_keys gem in my
environment.rb file I get this error message:

>ruby script/server

=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/
dependencies.rb:440:in `load_missing_constant': uninitialized constant
ActiveRecord::Associations (NameError)
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/dependencies.rb:80:in `const_missing'
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/base.rb:3144
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/base.rb:3137:in `class_eval'
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/base.rb:3137
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/associations.rb:2
from c:/ruby/lib/ruby/gems/1.8/gems/
composite_primary_keys-2.2.2/lib/composite_primary_keys/
associations.rb:67
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
... 15 levels...
from c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/
server.rb:84
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `gem_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
from script/server:3

If I removed the require my project starts fine and only crashes when
I try to use commands from the gem I haven't included...

I've googled for several hours and I can't find any help to solve this
issue. All thoughts would be appreciated!

Thanks,
Stewart

P.S. I'm using WinXP and my complete gem list is as follows:

*** LOCAL GEMS ***

actionmailer (2.3.2, 2.1.2)
actionpack (2.3.2, 2.1.2)
activerecord (2.2.2, 2.1.2)
activerecord-oracle-adapter (1.0.0.9250)
activeresource (2.3.2, 2.1.2)
activesupport (2.3.2, 2.2.2, 2.1.2)
acts_as_reportable (1.1.1)
archive-tar-minitar (0.5.2)
cgi_multipart_eof_fix (2.5.0)
color (1.4.0)
columnize (0.3.0)
composite_primary_keys (2.2.2, 1.0.2)
fastercsv (1.4.0, 1.2.3)
fastthread (1.0.1)
fxri (0.3.6)
fxruby (1.6.12)
gem_plugin (0.2.3)
hoe (1.8.3)
hpricot (0.6)
linecache (0.43)
log4r (1.0.5)
mechanize (0.7.6)
mongrel (1.1.5)
mysql (2.7.3)
pdf-writer (1.1.8)
rails (2.3.2, 2.1.2)
rake (0.8.4, 0.8.3, 0.7.3)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.5)
ruby-net-ldap (0.0.4)
ruby-oci8 (1.0.4)
ruby-ole (1.2.8.1)
rubyforge (1.0.2)
rubygems-update (1.3.1)
ruport (1.6.1)
sources (0.0.1)
spreadsheet (0.6.3.1)
sqlite3-ruby (1.2.1)
transaction-simple (1.4.0)
win32-api (1.0.4)
win32-clipboard (0.4.3)
win32-dir (0.3.2)
win32-eventlog (0.4.6)
win32-file (0.5.4)
win32-file-stat (1.2.7)
win32-process (0.5.3)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.2.0)
windows-pr (0.7.2)

ninocito

unread,
Jul 16, 2009, 12:00:20 AM7/16/09
to Composite Keys for ActiveRecord
Hi Stewart,
Try the following:
Find composite_primary_keys.rb in the cpk gem amd modify it to add

load 'active_record/associations.rb'

after the line that requires active_record
I am pretty sure that will get you going.
Good luck
Pablo

On Jul 15, 8:17 pm, stewart <sbryce...@gmail.com> wrote:
> Hi all,
>
> I've recently upgraded my project from rails 2.1.2 to 2.3.2.  However,
> if I try and require the composite_primary_keys gem in my
> environment.rb file I get this error message:
>
> >ruby script/server
>
> => Booting Mongrel
> => Rails 2.3.2 application starting onhttp://0.0.0.0:3000

stewart

unread,
Jul 16, 2009, 12:17:49 AM7/16/09
to Composite Keys for ActiveRecord
Hi Pablo,

Yeah, that fixes it :)

Thanks for the prompt reply and help!!!

Cheers,
Stewart

darrinholst

unread,
Jul 16, 2009, 8:48:05 AM7/16/09
to Composite Keys for ActiveRecord
I just added that and pushed version 2.3.2 to rubyforge.

Thanks,
Darrin
Reply all
Reply to author
Forward
0 new messages