# What is a NameError?

**URL:** <https://www.ruby-forum.com/t/what-is-a-nameerror/139469>\
**Category:** Rails\
**Created:** [June 4, 2008, 6:21am UTC](https://www.ruby-forum.com/t/what-is-a-nameerror/139469 "2008-06-04T06:21:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 4, 2008, 6:21am UTC](https://www.ruby-forum.com/t/what-is-a-nameerror/139469/1 "2008-06-04T06:21:26Z")

</div>

Hi,

What is a NameError? When I visit the root page of my application, I  
get an application error. Upon checking the logs, the stack trace is  
below. I have also included my environment.rb and routes.rb files, if  
that’s helpful. Any direction you can point me in is most  
appreciated.

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/  
active\_support/dependencies.rb:266:in `load_missing_constant': uninitialized constant UserObserver (NameError) from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:452:in `const\_missing’  
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/  
active\_support/dependencies.rb:464:in `const_missing' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/inflector.rb:250:in `constantize’  
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/  
active\_support/core\_ext/string/inflections.rb:148:in `constantize' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/observer.rb:38:in `instantiate\_observers’  
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/  
active\_record/observer.rb:36:in `each' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/observer.rb:36:in `instantiate\_observers’  
from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:  
212:in `load_observers' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb: 108:in `process’  
from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:  
43:in `send' from /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb: 43:in `run’  
from ./…/config/environment.rb:13  
from dispatch.cgi:3:in `require’  
from dispatch.cgi:3

===================start  
environment.rb=================================

# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when

# you don’t control web/app server and can’t set it the proper way

# ENV[‘RAILS\_ENV’] ||= ‘production’

# Specifies gem version of Rails to use when vendor/rails is not

present  
RAILS\_GEM\_VERSION = ‘1.2.3’ unless defined? RAILS\_GEM\_VERSION

# Bootstrap the Rails environment, frameworks, and default

configuration  
require File.join(File.dirname( **FILE** ), ‘boot’)

Rails::Initializer.run do |config|

# Settings in config/environments/\* take precedence over those

specified here

# Skip frameworks you’re not going to use (only works if using

vendor/rails)

# config.frameworks -= [:action\_web\_service, :action\_mailer]

# Only load the plugins named here, by default all plugins in vendor/

plugins are loaded

# config.plugins = %W( exception\_notification ssl\_requirement )

# Add additional load paths for your own custom dirs

# config.load\_paths += %W( #{RAILS\_ROOT}/extras )

# Force all environments to use the same logger level

# (by default production uses :info, the others :debug)

# config.log\_level = :debug

# Use the database for sessions instead of the file system

# (create the session table with ‘rake db:sessions:create’)

# config.action\_controller.session\_store = :active\_record\_store

# Use SQL instead of Active Record’s schema dumper when creating the

test database.

# This is necessary if your schema can’t be completely dumped by the

schema dumper,

# like if you have constraints or database-specific column types

# config.active\_record.schema\_format = :sql

# Activate observers that should always be running

# config.active\_record.observers = :cacher, :garbage\_collector

# Make Active Record use UTC-base instead of local time

# config.active\_record.default\_timezone = :utc

# Add new inflection rules using the following format

# (all these examples are active by default):

# Inflector.inflections do |inflect|

# inflect.plural /^(ox)$/i, ‘\1en’

# inflect.singular /^(ox)en/i, ‘\1’

# inflect.irregular ‘person’, ‘people’

# inflect.uncountable %w( fish sheep )

# end

# See Rails::Configuration for more options

end

# Add new mime types for use in respond\_to blocks:

# Mime::Type.register “text/richtext”, :rtf

# Mime::Type.register “application/x-mobile”, :mobile

# Include your application configuration below

ActionMailer::Base.delivery\_method = :smtp  
ActionMailer::Base.smtp\_settings = {  
:address =\> “[mail.mydomain.us](http://mail.mydomain.us)”,  
:port =\> 25,  
:domain =\> “[mydomain.us](http://mydomain.us)”,  
:user\_name =\> “admin”,  
:password =\> “password”,  
:authentication =\> :login  
}  
ActionMailer::Base.raise\_delivery\_errors = true  
=====================end  
environment.rb================================

===================start routes.rb=================================  
ActionController::Routing::Routes.draw do |map|

# The priority is based upon order of creation: first created →

highest priority.

# Sample of regular route:

# map.connect ‘products/:id’, :controller =\> ‘catalog’, :action =\>

‘view’

# Keep in mind you can assign values other than :controller

and :action

# Sample of named route:

# map.purchase ‘products/:id/purchase’, :controller =\>

‘catalog’, :action =\> ‘purchase’

# This route can be invoked with purchase\_url(:id =\> product.id)

# You can have the root of your site routed by hooking up ‘’

# – just remember to delete public/index.html.

map.connect ‘’, :controller =\> ‘application’, :action =\> ‘index’

# Allow downloading Web Service WSDL as a file with an extension

# instead of a file named ‘wsdl’

map.connect ‘:controller/service.wsdl’, :action =\> ‘wsdl’

# Install the default route as the lowest priority.

map.connect ‘:controller/:action/:id.:format’  
map.connect ‘:controller/:action/:id’

map.page ‘:permalink’, :controller =\> ‘page’, :action =\> ‘show’  
map.signup ‘easy\_order/signup’, :controller =\> ‘page’, :action =\>  
‘signup’

end  
=====================end routes.rb================================

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 4, 2008, 8:30am UTC](https://www.ruby-forum.com/t/what-is-a-nameerror/139469/2 "2008-06-04T08:30:25Z")

</div>

On 4 Jun 2008, at 05:21, removed\_email\_address@domain.invalid wrote:

> Hi,
> 
> What is a NameError? When I visit the root page of my application, I  
> get an application error. Upon checking the logs, the stack trace is  
> below. I have also included my environment.rb and routes.rb files, if  
> that’s helpful. Any direction you can point me in is most  
> appreciated.

NameError means ‘I couldn’t find that’. do you have a file  
user\_observer.rb defining a UserObserver class ?

Fred
