Expected ... to define (rails version 1.2.2)


#1

Hi, I’m having a mysterious problem that occurs when I’m using Rails
1.2.2. My app works fine when the environment.rb file reads:

RAILS_GEM_VERSION = ‘1.1.6’

When I change this to:

RAILS_GEM_VERSION = ‘1.2.2’

and try to load http://:3000/srs/, I get the following
traceback in the developer log:

Expected
/Users/thoth/Source/taskmaster/public/…/config/…/app/controllers/srs_controller.rb
to define SrsController
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/dependencies.rb:249:in
load_missing_constant' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/dependencies.rb:452:inconst_missing’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/dependencies.rb:464:in
const_missing' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/inflector.rb:250:inconstantize’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/core_ext/string/inflections.rb:148:in
constantize' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/routing.rb:1284:inrecognize’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/dispatcher.rb:40:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/fcgi_handler.rb:168:inprocess_request’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/fcgi_handler.rb:143:in
process_each_request!' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/fcgi_handler.rb:109:inwith_signal_handler’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/fcgi_handler.rb:142:in
process_each_request!' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:612:ineach_cgi’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:609:in each' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:609:ineach_cgi’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/fcgi_handler.rb:141:in
process_each_request!' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/fcgi_handler.rb:55:inprocess!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/fcgi_handler.rb:25:in
`process!’
/Users/thoth/Source/taskmaster/public/dispatch.fcgi:24

This is on Mac OS X 10.4.9, ruby 1.8.5, rails 1.2.2. Anyone have any
idea why this would work fine when configured to use Rails 1.1.6, but
not 1.2.2? Note that this project was originally generated by 1.1.6.
I’d like to upgrade it to 1.2.2.

steven


#2

the upgrade shouldn’t have caused this. It sounds like the file

srs_controller.rb

does not contain

class SrsController


#3

Presumable this file exists but the class does not
if this is not immediately apparent could you post the contents of that
file?


#4

Keynan P. wrote:

Presumable this file exists but the class does not
if this is not immediately apparent could you post the contents of that
file?

It’s a very large file, but here is an abbreviated listing:

class SrsController < ApplicationController
layout “main”

# GETs should be safe (see 

http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }

[numerous methods omitted]

end

[a handful of other classes defined below this]

Also, it seems strange that it would work fine when
RAILS_GEM_VERSION=1.1.6. To me, this makes it unlikely that the problem
is syntax errors or simple omission of class definitions, but perhaps
Rails 1.2.2 is looking in the wrong directory or something of that
nature? (Yet that doesn’t make sense either, because when I vi
/Users/thoth/Source/taskmaster/public/…/config/…/app/controllers/srs_controller.rb,
the file exists and it defines SrsController as above. I performed an
MD5 checksum on the path above and the more conventional path to
srs_controller.rb just to make sure they’re the same, and indeed they
are.)

steven