Forum: Ruby on Rails NameError what is it?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Steve D. (Guest)
on 2009-06-09 06:40
I have the following code in app/controllers/processjobs_controller.rb
#
class ProcessJobsController <ApplicationController
  def index
    @ProcessJobs = ProcessJobs.find(:all)
  end
end
#

This is my route file ..
ActionController::Routing::Routes.draw do |map|
  map.resources :ProcessJobs

  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

When I point my browser to localhost:3000/ProcessJobs, this is what I
see in the log file. When I see the first few lines, it appears that
rails is trying to logon as 'sa'. The database.yml file has the
following contents.

development:
  adapter  : sqlserver
  mode : odbc
  dsn : Driver={SQL Server};Server=<server>
  database : ODS
  username : <definitely_not_sa>
  password : <pwd>

The log file also shows this :
NameError (uninitialized constant ProcessJobsController)

Not sure how to interpret this message.

The contents of the log file follows:

/!\ FAILSAFE /!\  Mon Jun 08 08:42:58 -0500 2009
  Status: 500 Internal Server Error
  28000 (18456) [Microsoft][ODBC SQL Server Driver][SQL Server]Login
failed for user 'sa'.
    d:/ruby/lib/ruby/gems/1.8/gems/dbd-odbc-0.2.4/lib/dbd/odbc/driver.rb:36:in
`connect'
    d:/ruby/lib/ruby/gems/1.8/gems/dbi-0.4.1/lib/dbi/handles/driver.rb:33:in
`connect'
    d:/ruby/lib/ruby/gems/1.8/gems/dbi-0.4.1/lib/dbi.rb:142:in `connect'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.18/lib/active_record/connection_adapters/sqlserver_adapter.rb:775:in
`connect'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.18/lib/active_record/connection_adapters/sqlserver_adapter.rb:211:in
`initialize'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.18/lib/active_record/connection_adapters/sqlserver_adapter.rb:26:in
`new'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.18/lib/active_record/connection_adapters/sqlserver_adapter.rb:26:in
`sqlserver_connection'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`send'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`checkout'
    d:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in
`retrieve_connection'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in
`connection'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:9:in
`cache'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:28:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/head.rb:9:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/methodoverride.rb:24:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/params_parser.rb:15:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/rewindable_input.rb:25:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:93:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/reloader.rb:9:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/failsafe.rb:11:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in
`synchronize'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:106:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/static.rb:31:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb:46:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in
`each'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/log_tailer.rb:17:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/content_length.rb:13:in
`call'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb:46:in
`service'
    d:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    d:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    d:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    d:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
    d:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
    d:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
    d:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
    d:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
    d:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
    d:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
    d:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb:13:in
`run'
    d:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:111
    d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
    d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
    script/server:3


Processing ActionController::Base#index (for 127.0.0.1 at 2009-06-08
13:04:12) [GET]

NameError (uninitialized constant ProcessJobsController):
  d:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  d:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  d:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  d:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
  d:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  d:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
  d:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
  d:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
  d:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
  d:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendered rescues/_trace (109.0ms)
Rendered rescues/_request_and_response (0.0ms)
Rendering rescues/layout (internal_server_error)
Maurício L. (Guest)
on 2009-06-09 06:43
(Received via mailing list)
Either change your filename to
"app/controllers/process_jobs_controller.rb" or make the "J" on job
lowercase.

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr



On Mon, Jun 8, 2009 at 11:40 PM, Steve
Sijo k. (Guest)
on 2009-06-09 08:14
Just do
  ./script/generate scaffold ProcessJob
from project root directory and watch what the names of model,
controller etc and compare

Sijo
Steve D. (Guest)
on 2009-06-09 18:09
Sijo Kg wrote:
> Just do
>   ./script/generate scaffold ProcessJob
> from project root directory and watch what the names of model,
> controller etc and compare
>
> Sijo

Thanks, it did help.
This topic is locked and can not be replied to.