Reputation: 1405
I recently installed the Bundle gem (stable 2.3.x) with a integrated 3.0 release. The documentation for installing 2.3.x is weak, so I'm looking for help here.
I've done everything from this article on installing and configuring gem bundler (Installing gem bundler, defining Gemfile, adding preinitializer.rb, requiring bundler_gems/environment.rb):
http://litanyagainstfear.com/blog/2009/10/14/gem-bundler-is-the-future/
I can run script/server successfully, but when I try to access any page via my browser, I get a 500 Internal Server Error claiming many ActionView methods are undefined:
ActionView::TemplateError (undefined method `debug' ...
ActionView::TemplateError (undefined method `javascript_tag' ...
There has to be some gem dependency failing somewhere or something? Here's my Gemfile (rails 2.3.5):
clear_sources
bundle_path "vendor/bundler_gems"
source "http://gems.github.com"
source "http://gemcutter.org"
gem "rails", "2.3.5"
gem "formtastic"
gem "authlogic"
gem "will_paginate"
gem "cancan"
Any pointers?
Upvotes: 1
Views: 1878
Reputation: 1405
Updated as Gem Bundler Documentation improves:
http://gembundler.com/rails23.html
Upvotes: 0
Reputation: 1405
For reference, bundle is now on 0.9.5. Here is the newest rails 2.3.5 config (you can basically ignore everything else here):
Upvotes: 1
Reputation: 15229
Most (or all) of these gems are Rails plugins. You should require them during Rails initialization phase. Stick this in your after_initialize
:
config.after_initialize do
Bundler.require_env
end
Upvotes: 0
Reputation: 1405
So for configuring gem bundler on Rails 2.3.5:
I changed my preinitializer.rb script to this:
# Load the environment constructed from the Gemfile
require "#{File.dirname(__FILE__)}/../vendor/bundler_gems/environment"
module Rails
class Boot
def run
load_initializer
extend_environment
Rails::Initializer.run(:set_load_path)
end
def extend_environment
Rails::Initializer.class_eval do
old_load = instance_method(:load_gems)
define_method(:load_gems) do
old_load.bind(self).call
Bundler.require_env RAILS_ENV
end
end
end
end
end
And removed any Bundler.require_env definitions from config/environment.rb, and all was good.
Upvotes: 1