Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Improvements/bugs in rails 2.3 integration example code #258

Closed
betelgeuse opened this issue Apr 6, 2010 · 6 comments
Closed

Improvements/bugs in rails 2.3 integration example code #258

betelgeuse opened this issue Apr 6, 2010 · 6 comments

Comments

@betelgeuse
Copy link

Maybe you are in touch with the people who maintain various rails 2.3 bundler integration instructions. At least one found in http://gembundler.com/rails23.html is buggy in two regards:

  1. preinitializer.rb two code paths behave differently
  • without LoadError no require happens but with LoadError :default is required
  • I added Bundler.require :default to the begin rescue block
  1. boot.rb needs to load gems later
    • currently the code ties to :load_environment but it should use :load_plugins
    • the loading of various rails classes|modules seems to happens between :load_environment
      and :load_plugins with all the autoloads and magic in rails
    • if you have gem plugin expecting rails to be setup it will fail not finding classes like
uninitialized constant ActiveRecord::Associations
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3154
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147:in `class_eval'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/base.rb:3147
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations.rb:2
/usr/lib/ruby/gems/1.8/gems/hobosupport-1.0.0/lib/hobo_support/methodcall.rb:97
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/hobosupport-1.0.0/lib/hobosupport.rb:6
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo.rb:2

With these two things in order I was able to get my specs to pass on one of my rails 2.3 applications.

@indirect
Copy link
Member

indirect commented Apr 6, 2010

Thanks for pointing out the error with Bundler.require. I'll fix it. In #2, what gem plugin are you using, and how are you requiring it? I need to be able to reproduce your problem before I can change the docs.

@betelgeuse
Copy link
Author

clone this and run rake http://github.com/betelgeuse/hobo-rails23-bundler

@indirect
Copy link
Member

indirect commented Apr 6, 2010

Thanks for the test case -- that made it easy to massively simplify the bundler setup. I'll update the bundler docs shortly, and in the meantime you can see the new instructions here: http://andre.arko.net/2010/02/13/using-bundler-09-with-rails-235/

@betelgeuse
Copy link
Author

load_gems is called twice but I guess that doesn't matter

@indirect
Copy link
Member

indirect commented Apr 6, 2010

ah, thanks for pointing that out. It doesn't actually matter, but it's easy enough to make sure it only gets run once. I'll do that.

@indirect
Copy link
Member

indirect commented Apr 6, 2010

gembundler.com is now updated.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants