# Uninitialized constant ActionController (NameError)

**URL:** <https://rubytalk.org/t/uninitialized-constant-actioncontroller-nameerror/55772>\
**Category:** ruby-talk\
**Created:** [12 October 2009 14:37 UTC](https://rubytalk.org/t/uninitialized-constant-actioncontroller-nameerror/55772 "2009-10-12T14:37:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Gutlein](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@Martin\_Gutlein](https://rubytalk.org/u/Martin_Gutlein)\
**Post date:** [12 October 2009 14:37 UTC](https://rubytalk.org/t/uninitialized-constant-actioncontroller-nameerror/55772/1 "2009-10-12T14:37:08Z")

</div>

Hello,

My ruby cannot find a class from the actionpack gem:

&nbsp;&nbsp;require 'rubygems'  
&nbsp;&nbsp;require 'actionpack'  
&nbsp;&nbsp;ActionController::Session::AbstractStore  
=\> uninitialized constant ActionController (NameError)

Directly adding the code works, though:

&nbsp;&nbsp;require 'actionpack'  
&nbsp;&nbsp;load  
"/var/lib/gems/1.8/gems/actionpack-2.3.4/lib/action\_controller/session/abstract\_store.rb"  
&nbsp;&nbsp;ActionController::Session::AbstractStore  
=\> no error.

This problem occurs when I try to require dm-core, which needs  
rails\_datamapper, which uses the AbstractStore Class.

Thanks for your help

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://rubytalk.org/u/Brian_Candler)\
**Post date:** [13 October 2009 10:08 UTC](https://rubytalk.org/t/uninitialized-constant-actioncontroller-nameerror/55772/2 "2009-10-13T10:08:06Z")

</div>

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  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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:  
&nbsp;&nbsp;module VERSION #:nodoc:  
&nbsp;&nbsp;&nbsp;&nbsp;MAJOR = 2  
&nbsp;&nbsp;&nbsp;&nbsp;MINOR = 3  
&nbsp;&nbsp;&nbsp;&nbsp;TINY = 2

&nbsp;&nbsp;&nbsp;&nbsp;STRING = [MAJOR, MINOR, TINY].join('.')  
&nbsp;&nbsp;end  
end

So if you require 'actionpack', that's exactly all you will get.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
