From: Brian Candler Date: 2009-10-13T19:08:06+09:00 Subject: Re: uninitialized constant ActionController (NameError) Martin G端tlein wrote: > Hello, > > My ruby cannot find a class from the actionpack gem: Rails questions are best asked on a Rails mailing list. This list is for Ruby (the programming language). A smart question would also say what exact version of Rails you are using, and on what platform. But I would make the following comment: require 'foo' doesn't necessarily load everything inside the 'foo' package. It loads exactly what foo.rb tells it to load. You will need to look at the source of foo.rb to see if it loads what you want, and if it doesn't, you'll need to load what you want yourself. >> require 'rubygems' => true >> require 'actionpack' => true >> ActionController::Session::AbstractStore NameError: uninitialized constant ActionController from (irb):3 >> require 'action_controller' => true >> ActionController::Session::AbstractStore => ActionController::Session::AbstractStore >> [This is with rails-2.3.2 under Ubuntu Hardy with ruby-1.8.6p111 compiled from source] And you can see why easily: $ cat /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/actionpack.rb require 'action_pack' $ cat /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_pack.rb << snip copyright message >> require 'action_pack/version' $ cat /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_pack/version.rb module ActionPack #:nodoc: module VERSION #:nodoc: MAJOR = 2 MINOR = 3 TINY = 2 STRING = [MAJOR, MINOR, TINY].join('.') end end So if you require 'actionpack', that's exactly all you will get. -- Posted via http://www.ruby-forum.com/.