When using ActiveRecord::Associations outside of Rails, a NameError is thrown #616

Closed
lighthouse-import opened this Issue May 16, 2011 · 12 comments

Comments

Projects
None yet
1 participant
@lighthouse-import

Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/2577
Created by danielh - 2011-02-19 09:28:20 UTC

Here's an example irb session:

irb(main):002:0> require 'rubygems'
=> true
irb(main):003:0> require 'active_record'
=> true
irb(main):004:0> ActiveRecord
=> ActiveRecord
irb(main):005:0> ActiveRecord::Associations
NameError: uninitialized constant ActiveRecord::Associations
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:440:in load_missing_constant' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:inconst_missing'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3144
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3137:in `class_eval'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3137
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:2
from (irb):6
from :0

This happens because ruby loads the associations.rb file, which references ActiveRecordError before defining the Associations module. ActiveRecordError is defined in base.rb, which tries to include the Association module before it's been defined.

Patch attached.

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by Elijah Miller - 2009-06-06 15:43:28 UTC

+1 Applies cleanly to 2-3-stable and works, all tests pass.

No test cases are provided for this issue but here is a command to test. Run within activerecord/lib.

ruby -e "require 'activerecord'; ActiveRecord::Associations; puts 'pass'"

Before patch:

./../../activesupport/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant ActiveRecord::Associations (NameError)
    from ./../../activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
    from ./active_record/base.rb:3139
    from ./active_record/base.rb:3132:in `class_eval'
    from ./active_record/base.rb:3132
    from ./active_record/associations.rb:2
    from -e:1

After patch:

pass

Imported from Lighthouse.
Comment by Elijah Miller - 2009-06-06 15:43:28 UTC

+1 Applies cleanly to 2-3-stable and works, all tests pass.

No test cases are provided for this issue but here is a command to test. Run within activerecord/lib.

ruby -e "require 'activerecord'; ActiveRecord::Associations; puts 'pass'"

Before patch:

./../../activesupport/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant ActiveRecord::Associations (NameError)
    from ./../../activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
    from ./active_record/base.rb:3139
    from ./active_record/base.rb:3132:in `class_eval'
    from ./active_record/base.rb:3132
    from ./active_record/associations.rb:2
    from -e:1

After patch:

pass
@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by Elijah Miller - 2009-06-06 16:34:04 UTC

For now a simple work-around is to reference ActiveRecord::ActiveRecordError before ActiveRecord::Associations

require 'activerecord'
ActiveRecord::ActiveRecordError
# now you can use ActiveRecord::Associations

Imported from Lighthouse.
Comment by Elijah Miller - 2009-06-06 16:34:04 UTC

For now a simple work-around is to reference ActiveRecord::ActiveRecordError before ActiveRecord::Associations

require 'activerecord'
ActiveRecord::ActiveRecordError
# now you can use ActiveRecord::Associations
@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by Murray Steele - 2009-08-05 16:32:12 UTC

The same is true if you try to use ActiveRecord::Validations. The similarities are that both active_record/validations.rb and active_record/associations.rb both define ActiveRecordError subclasses before they define their Validations and Associations modules.

Note really sure what the fix is. It also affects 3.0.

Imported from Lighthouse.
Comment by Murray Steele - 2009-08-05 16:32:12 UTC

The same is true if you try to use ActiveRecord::Validations. The similarities are that both active_record/validations.rb and active_record/associations.rb both define ActiveRecordError subclasses before they define their Validations and Associations modules.

Note really sure what the fix is. It also affects 3.0.

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by ggwang - 2009-12-01 00:03:51 UTC

It seems to be same problem, the following is #3528 I added just now:

I am intending to have a try to use CMS ansuz(http://www.ansuzcms.com/). But Ijust can not make it get to work. When ever start up the webtick server, or try to migrate its database(yml setting finished), it shows:

=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant ActiveRecord::Associations (NameError) from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst_missing'
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3154
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147:in class_eval' from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147 from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:2 from /home/ggwang/ansuz/lib/isotope11/active_record_extensions.rb:2 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/ansuz/config/environments/development.rb:24:in load_environment' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:386:inload_environment'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:379:inload_environment'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:137:in process' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:insend'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in run' from /home/ggwang/ansuz/config/environment.rb:39 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from script/server:3
ggwang@ggwang-laptop:~/ansuz$ ruby script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant ActiveRecord::Associations (NameError) from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst_missing'
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3154
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147:in class_eval' from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147 from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:2 from /home/ggwang/ansuz/lib/isotope11/active_record_extensions.rb:2 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/ansuz/config/environments/development.rb:24:in load_environment' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:386:inload_environment'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:379:inload_environment'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:137:in process' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:insend'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in run' from /home/ggwang/ansuz/config/environment.rb:39 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from script/server:3

I took referenced to the ticket #2577 and thought maybe that was the problem. I tried to use the patch file attached but could not make it work. The following is my gem list:

    *** LOCAL GEMS ***

actionmailer (2.3.5, 2.2.2)
actionpack (2.3.5, 2.3.2, 2.2.2)
activerecord (2.3.5, 2.3.2, 2.2.2)
activeresource (2.3.5, 2.2.2)
activesupport (2.3.5, 2.3.4, 2.3.2, 2.2.2)
BlueCloth (1.0.1)
calendar_date_select (1.15)
cmdparse (2.0.2)
datanoise-actionwebservice (2.3.2)
facets (2.4.5)
maruku (0.5.9)
mislav-will_paginate (2.2.3)
mocha (0.9.8)
mysql (2.8.1)
rack (1.0.1)
rails (2.3.5, 2.2.2)
rake (0.8.7)
rdoc (2.4.3)
RedCloth (4.2.2)
rubygems-update (1.3.5)
rubyist-aasm (2.0.7)
sqlite3-ruby (1.2.5)
syntax (1.0.0)
webgen (0.5.10)
will_paginate (2.3.11, 2.2.2)

And, I followed the ticket to test in irb and it shows:

:~/ansuz$ ruby -e "require 'rubygems';require 'active_record'; ActiveRecord::Associations; puts 'pass'"
/home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant ActiveRecord::Associations (NameError) from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst_missing'
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3154
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147:in `class_eval'
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:2
from -e:1

Is it really a bug of rails? Can anyone help me?

Imported from Lighthouse.
Comment by ggwang - 2009-12-01 00:03:51 UTC

It seems to be same problem, the following is #3528 I added just now:

I am intending to have a try to use CMS ansuz(http://www.ansuzcms.com/). But Ijust can not make it get to work. When ever start up the webtick server, or try to migrate its database(yml setting finished), it shows:

=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant ActiveRecord::Associations (NameError) from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst_missing'
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3154
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147:in class_eval' from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147 from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:2 from /home/ggwang/ansuz/lib/isotope11/active_record_extensions.rb:2 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/ansuz/config/environments/development.rb:24:in load_environment' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:386:inload_environment'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:379:inload_environment'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:137:in process' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:insend'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in run' from /home/ggwang/ansuz/config/environment.rb:39 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from script/server:3
ggwang@ggwang-laptop:~/ansuz$ ruby script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant ActiveRecord::Associations (NameError) from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst_missing'
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3154
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147:in class_eval' from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147 from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:2 from /home/ggwang/ansuz/lib/isotope11/active_record_extensions.rb:2 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/ansuz/config/environments/development.rb:24:in load_environment' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:386:inload_environment'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:379:inload_environment'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:137:in process' from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:insend'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in run' from /home/ggwang/ansuz/config/environment.rb:39 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire'
from /home/ggwang/.gem/ruby/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from script/server:3

I took referenced to the ticket #2577 and thought maybe that was the problem. I tried to use the patch file attached but could not make it work. The following is my gem list:

    *** LOCAL GEMS ***

actionmailer (2.3.5, 2.2.2)
actionpack (2.3.5, 2.3.2, 2.2.2)
activerecord (2.3.5, 2.3.2, 2.2.2)
activeresource (2.3.5, 2.2.2)
activesupport (2.3.5, 2.3.4, 2.3.2, 2.2.2)
BlueCloth (1.0.1)
calendar_date_select (1.15)
cmdparse (2.0.2)
datanoise-actionwebservice (2.3.2)
facets (2.4.5)
maruku (0.5.9)
mislav-will_paginate (2.2.3)
mocha (0.9.8)
mysql (2.8.1)
rack (1.0.1)
rails (2.3.5, 2.2.2)
rake (0.8.7)
rdoc (2.4.3)
RedCloth (4.2.2)
rubygems-update (1.3.5)
rubyist-aasm (2.0.7)
sqlite3-ruby (1.2.5)
syntax (1.0.0)
webgen (0.5.10)
will_paginate (2.3.11, 2.2.2)

And, I followed the ticket to test in irb and it shows:

:~/ansuz$ ruby -e "require 'rubygems';require 'active_record'; ActiveRecord::Associations; puts 'pass'"
/home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant ActiveRecord::Associations (NameError) from /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:inconst_missing'
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3154
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147:in `class_eval'
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147
from /home/ggwang/.gem/ruby/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:2
from -e:1

Is it really a bug of rails? Can anyone help me?

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by seraphim - 2009-12-22 06:31:00 UTC

I ran into the same problem... anyone solved the issue?

Imported from Lighthouse.
Comment by seraphim - 2009-12-22 06:31:00 UTC

I ran into the same problem... anyone solved the issue?

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by PeppyHeppy - 2009-12-30 10:31:10 UTC

ditto

Imported from Lighthouse.
Comment by PeppyHeppy - 2009-12-30 10:31:10 UTC

ditto

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by Rizwan Reza - 2010-01-18 13:13:28 UTC

I can reproduce this in Rails 3 pre.

Imported from Lighthouse.
Comment by Rizwan Reza - 2010-01-18 13:13:28 UTC

I can reproduce this in Rails 3 pre.

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by Rhett Sutphin - 2010-04-03 01:28:13 UTC

Seems to me that the lowest-impact fix would be to move ActiveRecordError out of base.rb and into its own file. That would break the autoload cycle (ActiveRecordError loads from base.rb, base.rb loads Associations, Associations loads ActiveRecordError).

In any case, another workaround is to explicitly require 'active_record/base' after requiring 'active_record'.

Imported from Lighthouse.
Comment by Rhett Sutphin - 2010-04-03 01:28:13 UTC

Seems to me that the lowest-impact fix would be to move ActiveRecordError out of base.rb and into its own file. That would break the autoload cycle (ActiveRecordError loads from base.rb, base.rb loads Associations, Associations loads ActiveRecordError).

In any case, another workaround is to explicitly require 'active_record/base' after requiring 'active_record'.

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by Jeremy Kemper - 2010-05-04 17:48:48 UTC

[bulk edit]

Imported from Lighthouse.
Comment by Jeremy Kemper - 2010-05-04 17:48:48 UTC

[bulk edit]

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by Santiago Pastorino - 2011-02-02 16:28:50 UTC

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.

Imported from Lighthouse.
Comment by Santiago Pastorino - 2011-02-02 16:28:50 UTC

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.

@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Imported from Lighthouse.
Comment by Betelgeuse - 2011-02-02 17:35:16 UTC

[state:open]

irb(main):008:0> ActiveRecord::Associations
NameError: uninitialized constant ActiveRecord::Associations
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/dependencies.rb:466:in `load_missing_constant'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/dependencies.rb:106:in `const_missing'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.10/lib/active_record/base.rb:3207
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.10/lib/active_record/base.rb:3200:in `class_eval'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.10/lib/active_record/base.rb:3200
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.10/lib/active_record/associations.rb:2
        from (irb):8

Imported from Lighthouse.
Comment by Betelgeuse - 2011-02-02 17:35:16 UTC

[state:open]

irb(main):008:0> ActiveRecord::Associations
NameError: uninitialized constant ActiveRecord::Associations
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/dependencies.rb:466:in `load_missing_constant'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/dependencies.rb:106:in `const_missing'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.10/lib/active_record/base.rb:3207
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.10/lib/active_record/base.rb:3200:in `class_eval'
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.10/lib/active_record/base.rb:3200
        from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.10/lib/active_record/associations.rb:2
        from (irb):8
@lighthouse-import

This comment has been minimized.

Show comment Hide comment
@lighthouse-import

lighthouse-import May 16, 2011

Attachments saved to Gist: http://gist.github.com/971630

Attachments saved to Gist: http://gist.github.com/971630

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment