Expected .. to define

Hi,

I am trying to setup a simple Ruby web application with Oracle. I am
able to connect to my oracle database with other test rb program.
However, it is not working under webBrick. When I run the generated test
file by Ruby, I was able to reproduce the same exception.

Can someone please help?

Loaded suite RubyDemo/test/functional/applications_controller_test
Started
EEEEEEEE
Finished in 0.079 seconds.

  1. Error:
    test_create(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define
    Application
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
    load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
    const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:inconstantize’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
    constantize' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:412:invalue_list’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:290:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:ineach’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:in
    each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
    transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:255:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:867:in
    silence' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:248:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in
    load_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:insetup_with_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in
    `setup’

  2. Error:
    test_destroy(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define
    Application
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
    load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
    const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:inconstantize’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
    constantize' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:412:invalue_list’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:290:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:ineach’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:in
    each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
    transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:255:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:867:in
    silence' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:248:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in
    load_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:insetup_with_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in
    `setup’

  3. Error:
    test_edit(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define
    Application
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
    load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
    const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:inconstantize’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
    constantize' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:412:invalue_list’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:290:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:ineach’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:in
    each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
    transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:255:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:867:in
    silence' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:248:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in
    load_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:insetup_with_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in
    `setup’

  4. Error:
    test_index(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define
    Application
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
    load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
    const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:inconstantize’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
    constantize' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:412:invalue_list’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:290:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:ineach’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:in
    each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
    transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:255:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:867:in
    silence' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:248:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in
    load_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:insetup_with_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in
    `setup’

  5. Error:
    test_list(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define
    Application
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
    load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
    const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:inconstantize’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
    constantize' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:412:invalue_list’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:290:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:ineach’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:in
    each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
    transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:255:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:867:in
    silence' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:248:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in
    load_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:insetup_with_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in
    `setup’

  6. Error:
    test_new(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define
    Application
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
    load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
    const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:inconstantize’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
    constantize' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:412:invalue_list’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:290:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:ineach’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:in
    each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
    transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:255:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:867:in
    silence' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:248:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in
    load_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:insetup_with_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in
    `setup’

  7. Error:
    test_show(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define
    Application
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
    load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
    const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:inconstantize’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
    constantize' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:412:invalue_list’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:290:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:ineach’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:in
    each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
    transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:255:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:867:in
    silence' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:248:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in
    load_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:insetup_with_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in
    `setup’

  8. Error:
    test_update(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define
    Application
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:249:in
    load_missing_constant' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:inconst_missing’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
    const_missing' C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:inconstantize’
    C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/core_ext/string/inflections.rb:148:in
    constantize' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:412:invalue_list’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:290:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:ineach’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:289:in
    insert_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:in
    each' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:257:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
    transaction' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:255:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:867:in
    silence' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:248:increate_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:593:in
    load_fixtures' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:538:insetup_with_fixtures’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixtures.rb:575:in
    `setup’

8 tests, 0 assertions, 0 failures, 8 errors

Tommy Wu wrote:

  1. Error:
    test_create(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define Application

Have you modified application.rb in any way? Uncommented anything by
accident? Uncommented lines will frequently cause this.

Douglas S. wrote:

Tommy Wu wrote:

  1. Error:
    test_create(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define Application

Have you modified application.rb in any way? Uncommented anything by
accident? Uncommented lines will frequently cause this.

No, I have not touched anything. All files were being generated by Ruby,
using ruby script/generate scaffold application command.

On 5/8/07, Tommy Wu [email protected] wrote:

Douglas S. wrote:

Tommy Wu wrote:

  1. Error:
    test_create(ApplicationsControllerTest):
    LoadError: Expected
    E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define Application

That means it’s loading application.rb looking for an Application
class, but app/controllers/application.rb defines
ApplicationController. For some reason it’s being loaded ahead of
lib/ and app/models. You may have to require your application class
manually or rename it.


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com

My application.rb class looks like this

Filters added to this controller apply to all controllers in the

application.

Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base

Pick a unique cookie name to distinguish our session data from

others’
session :session_key => ‘_RubyDemo_session_id’
end

And my applications_controller.rb looks like this

class ApplicationsController < ApplicationController
def index
list
render :action => ‘list’
end

GETs should be safe (see

URIs, Addressability, and the use of HTTP GET and POST)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }

def list
@application_pages, @applications = paginate :applications,
:per_page => 10
end

def show
@application = Application.find(params[:id])
end

def new
@application = Application.new
end

def create
@application = Application.new(params[:application])
if @application.save
flash[:notice] = ‘Application was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

def edit
@application = Application.find(params[:id])
end

def update
@application = Application.find(params[:id])
if @application.update_attributes(params[:application])
flash[:notice] = ‘Application was successfully updated.’
redirect_to :action => ‘show’, :id => @application
else
render :action => ‘edit’
end
end

def destroy
Application.find(params[:id]).destroy
redirect_to :action => ‘list’
end
end

Sorry, but I am not sure what you meant.

I began running into this problem tonight. The strange thing is that
I have the same codebase (from Subversion) installed on several
different sites. All but one work okay.

After digging around for quite a while, I noticed on one of my SVN UP
commands, my controller (the one causing me problems) had a conflict
which I hadn’t noticed before.

When I looked in the controllers directory, I found that my controller
was there but it had all kinds of merged code in it. I deleted all of
the controllers and the various SVN versions and restored the
controller from the repository. Voila… we’re working again.

Cheers.

MCN

On Tue, May 08, 2007 at 01:53:07PM -0500, Rick O. wrote :

LoadError: Expected
E:/work/Ruby/RubyDemo/config/…/app/controllers/application.rb to define Application

That means it’s loading application.rb looking for an Application
class, but app/controllers/application.rb defines
ApplicationController. For some reason it’s being loaded ahead of
lib/ and app/models. You may have to require your application class
manually or rename it.

Actually, for some reason it happens sometime (not only with
ApplicationController). See
http://dev.rubyonrails.org/ticket/7452 for example.

I had an application that suddenly blowed up in that way after a small
upgrade (in production mode) – just a dummy html change in a view. I
had to start - stop my app several times for it to load properly (see
the note of saizai for example on the ticket 7452).

That’s really weird (bug constated with Rails 1.2.2 & 1.2.3 with several
applications).


,========================.
| Pierre-Alexandre M. |
| email : [email protected] |
`========================’

Hello,

I wanted to chime in because I had a similar proble, Expected /
…/app/controllers/application.rb to define Application. On production
only. Rails 2.1.2, apache2, passenger. This thread was helpful and I
found in my stack trace the noted const_missing, originating at line 90
in one of my classes, permission.rb

vendor/rails/activesupport/lib/active_support/dependencies.rb:484:in 
`const_missing'
app/models/permission.rb:90:in `initialize_project'

The method in question had a case statement like so:

@project ||= case @resource
      when Project
        @resource
      ....
end

It was crapping out on line 90, which was:

when Project

I tried giving it an absolute path to Project, like so:

@project ||= case @resource
      when ::Project
        @resource
      ....
end

And this solved the problem.

Hopefully that helps someone as this thread helped me.

sg

Let me just add that while what I wrote above did work a few times, the
problem recurred. So I would not say that is a good solution. At this
point I manually required my classes in the other class:

require ‘project’
require ‘asset’

and this seems to work. It is a mystery to me, but hope someone else
is helped.

sg.

Sarah G. wrote:

Hello,

I wanted to chime in because I had a similar proble, Expected /
…/app/controllers/application.rb to define Application. On production
only. Rails 2.1.2, apache2, passenger. This thread was helpful and I
found in my stack trace the noted const_missing, originating at line 90
in one of my classes, permission.rb

vendor/rails/activesupport/lib/active_support/dependencies.rb:484:in 
`const_missing'
app/models/permission.rb:90:in `initialize_project'

The method in question had a case statement like so:

@project ||= case @resource
      when Project
        @resource
      ....
end

It was crapping out on line 90, which was:

when Project

I tried giving it an absolute path to Project, like so:

@project ||= case @resource
      when ::Project
        @resource
      ....
end

And this solved the problem.

Hopefully that helps someone as this thread helped me.

sg

On Jan 12, 12:59 pm, Caesar [email protected] wrote:

I also had the same problem. My application is running rails 2.0.2.
Has anyone actually found a good solution for this?

The error message is misleading. Expected foo.rb to define Foo usually
just means that something bad happened when loading foo.rb (syntax
errors, missing constant etc…). You can usually get a better error
message by just typing Foo into script/console

Fred

I also had the same problem. My application is running rails 2.0.2.
Has anyone actually found a good solution for this?

On Nov 25 2008, 11:35 am, Sarah G. <rails-mailing-l…@andreas-

I also had the same problem. My application is running rails 2.0.2.
Has anyone actually found a good solution for this?

Hope this helps someone who is in the same boat.

If you have a controller named ApplicationsController (there is
additional ‘s’ in the controller name) and also the corresponding
model Application, Rails is trying to load the wrong Application.rb
file which is why we are encountering the following message.

“Expected /…/app/controllers/application.rb to define Application.”

Instead of loading app/models/application.rb, it is loading app/
controllers/application.rb which is the base controller from which the
other controllers inherit, and not surprisingly it is not able to find
the Class definition of Application (it is actually defined in app/
models/application.rb)

I solved this by renaming the app/controllers/application.rb to app/
controllers/application_controller.rb and everything works as
expected.

-Satynos

On Jan 12, 9:21 am, Frederick C. [email protected]

My solution for this kind issue is

in app/controllers/application_controller.rb see if the below code
matches in the first line

class ApplicationController < ActionController::Base

Hope this helps someone who is in the same boat.

When you have controller named ApplicationsController and an
associated model named Application, Rails is loading the wrong
application.rb file and producing the following error. It is loading
the app/controllers/application.rb file instead of app/models/
application.rb when you instantiate Application object.

Expected /
…/app/controllers/application.rb to define Application.

Instead when you rename the app/controllers/application.rb (base
controller) to app/controllers/application_controller.rb, everything
works as expected.

-Satynos

On Jan 12, 9:21 am, Frederick C. [email protected]