This project is archived and is in readonly mode.

#5308 ✓stale
Ivo Wever

Requiring 'active_record/associations.rb' does not makeActiveRecord::Associations available

Reported by Ivo Wever | August 5th, 2010 @ 03:35 PM

(Ruby 1.8.7 on Linux x64, rubygems 1.3.7, activerecord 2.3.8 and composite_primary_keys

The smallest testcase with the components above is:

  ruby -e "require 'rubygems'; require 'active_record'; require 'composite_primary_keys'"
This will fail with
$RUBY_HOME/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant':
uninitialized constant ActiveRecord::Associations (NameError)
from $RUBY_HOME/lib/ruby/gems/1.8/gems/composite_primary_keys-
from -e:1

while requiring the composite_primary_keys. Line 36 in composite_primary_keys- says

  require 'active_record/associations.rb'
and if you change it to
  load 'active_record/associations.rb'
it will succeed, albeit with a warning about
already initialized constant HasManyThroughCantAssociateThroughHasManyReflection

However, requiring the file surely should Just Work(tm)?

Comments and changes to this ticket

  • Ivo Wever

    Ivo Wever September 18th, 2010 @ 12:40 PM

    Am I right in assuming that after

      require 'active_record'
    the constant ActiveRecord::Associations is supposed to be initialized/accessible?
  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:31 PM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:31 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket