Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Regarding to #2577 , something wrong with my associations.rb

#3528

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:in `const_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:in `gem_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:in `require'
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:in `require'
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:in `load_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:in `load_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:in `send'
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:in `gem_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:in `require'
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:in `require'
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:in `require'
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:in `const_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:in `gem_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:in `require'
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:in `require'
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:in `load_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:in `load_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:in `send'
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:in `gem_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:in `require'
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:in `require'
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:in `require'
from script/server:3

I took referenced to the ticket #2577 When using ActiveRecord::Associations outside of Rails, a NameError is thrown 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:in `const_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?

Reported by ggwang · November 30th, 2009 @ 11:59 PM

State: resolved
Milestone: none
Assigned to: Matt Jones Matt Jones
Importance: none

Activity

  1. Matt Jones
    Matt Jones

    The issue you've run into here isn't strictly related to #2577 When using ActiveRecord::Associations outside of Rails, a NameError is thrown - the problem is that ansuz's environment files are trying to patch AR before it is loaded. If you remove the last two lines from config/environments/development.rb and put them into an initializer, the error you're seeing will likely go away.

    Note that you're still facing a stiff headwind to actually get ansuz running - a quick skim shows that it uses the old 2.2-era Engines plugin, which you'll need to grab the latest version of from Github to have any chance at all of getting things working... You might try the mailing list, but it appears to have been overrun by spam.

    December 1st, 2009 @ 12:22 AM

  2. ggwang
    ggwang
    • Assigned user set to Matt Jones

    Thank you for the prompt reply and help!!!
    I followed that and add the following last two lines to dependencies.rb in initialaizer folder.

    require 'isotope11/active_record_extensions' require 'ansuz/setup'

    And then start webtick, It changed to showes:

    => Rails 2.3.4 application starting on http://0.0.0.0:3000 /home/ggwang/.gem/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:105:in const_missing': uninitialized constant Rails::Plugin::Dependencies (NameError)

    As you said, there maybe still a long way ahead to make it run. I am new to all these stuff.

    I found a quite simular issue on website and a solution was on that, I can not understand it quite well yet. Just for your reference.

    http://groups.google.com.ph/group/compositekeys/browse_thread/threa...

    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

    Thank you agian!

    December 1st, 2009 @ 09:53 AM

  3. Matt Jones
    Matt Jones
    • State changed from new to resolved

    Closing, as any remaining issues are likely Ansuz / 2.3.x compatibility problems.

    December 6th, 2009 @ 07:59 PM