LoadError (Expected model.rb to define Model)

Hello,

I'm having an error that occurs in production (on Dreamhost) but does
not occur in development on my local machine. The situation is that
there is a model (Article), and it uses act_as_ferret for search. The
error is as follows (where I say {full server path}, that's not what
the error says, just my note):

LoadError (Expected {full server path}/article.rb to define Article):
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:
249:in `load_missing_constant'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:
453:in `const_missing'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:
465:in `const_missing'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:
260:in `load_missing_constant'
    /vendor/rails/activesupport/lib/active_support/dependencies.rb:
469:in `const_missing'
    /app/controllers/articles_controller.rb:12:in `index'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1158:in
`send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1158:in
`perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:697:in
`call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:
68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:
68:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:199:in
`perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching.rb:678:in
`passenger_orig_perform_action'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/query_cache.rb:33:in `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in
`cache'
    /vendor/rails/actionpack/lib/action_controller/caching.rb:677:in
`passenger_orig_perform_action'
    /dh/passenger/lib/passenger/railz/request_handler.rb:53:in
`perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in
`send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in
`process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:685:in
`process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/
session_management.rb:123:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:388:in
`process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
171:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
115:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:
126:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in
`dispatch'
    /dh/passenger/lib/passenger/railz/request_handler.rb:38:in
`process_request'
    /dh/passenger/lib/passenger/abstract_request_handler.rb:163:in
`main_loop'
    /dh/passenger/lib/passenger/railz/application_spawner.rb:296:in
`start_request_handler'
    /dh/passenger/lib/passenger/railz/application_spawner.rb:265:in
`handle_spawn_application'
    /dh/passenger/lib/passenger/utils.rb:152:in `safe_fork'
    /dh/passenger/lib/passenger/utils.rb:150:in `fork'
    /dh/passenger/lib/passenger/utils.rb:150:in `safe_fork'
    /dh/passenger/lib/passenger/railz/application_spawner.rb:263:in
`handle_spawn_application'
    /dh/passenger/lib/passenger/utils.rb:152:in `safe_fork'
    /dh/passenger/lib/passenger/utils.rb:150:in `fork'
    /dh/passenger/lib/passenger/utils.rb:150:in `safe_fork'
    /dh/passenger/lib/passenger/railz/application_spawner.rb:262:in
`handle_spawn_application'
    /dh/passenger/lib/passenger/abstract_server.rb:306:in `__send__'
    /dh/passenger/lib/passenger/abstract_server.rb:306:in `main_loop'
    /dh/passenger/lib/passenger/abstract_server.rb:157:in
`start_synchronously'
    /dh/passenger/lib/passenger/abstract_server.rb:124:in `start'
    /dh/passenger/lib/passenger/abstract_server.rb:111:in `fork'
    /dh/passenger/lib/passenger/abstract_server.rb:111:in `start'
    /dh/passenger/lib/passenger/railz/application_spawner.rb:177:in
`start'
    /dh/passenger/lib/passenger/railz/framework_spawner.rb:270:in
`handle_spawn_application'
    /dh/passenger/lib/passenger/railz/framework_spawner.rb:263:in
`synchronize'
    /dh/passenger/lib/passenger/railz/framework_spawner.rb:263:in
`handle_spawn_application'
    /dh/passenger/lib/passenger/abstract_server.rb:306:in `__send__'
    /dh/passenger/lib/passenger/abstract_server.rb:306:in `main_loop'
    /dh/passenger/lib/passenger/abstract_server.rb:157:in
`start_synchronously'
    /dh/passenger/lib/passenger/abstract_server.rb:124:in `start'
    /dh/passenger/lib/passenger/abstract_server.rb:111:in `fork'
    /dh/passenger/lib/passenger/abstract_server.rb:111:in `start'
    /dh/passenger/lib/passenger/railz/framework_spawner.rb:87:in
`start'
    /dh/passenger/lib/passenger/spawn_manager.rb:224:in
`spawn_rails_application'
    /dh/passenger/lib/passenger/spawn_manager.rb:219:in `synchronize'
    /dh/passenger/lib/passenger/spawn_manager.rb:219:in
`spawn_rails_application'
    /dh/passenger/lib/passenger/spawn_manager.rb:122:in
`spawn_application'
    /dh/passenger/lib/passenger/spawn_manager.rb:253:in
`handle_spawn_application'
    /dh/passenger/lib/passenger/abstract_server.rb:306:in `__send__'
    /dh/passenger/lib/passenger/abstract_server.rb:306:in `main_loop'
    /dh/passenger/lib/passenger/abstract_server.rb:157:in
`start_synchronously'
    /dh/passenger/bin/passenger-spawn-server:46

For this app, Rails is frozen at 2.0.2. All gems are included in /
vendor. Any help would be most appreciated. Thanks.

Jonathan

This is the unfortunately vague error you can get when rails auto loads a file for you and an error occurs loading that file (eg that file tries to oad a gem and fails).
You might be able to get a more sensible error if you required the file article.rb explicitly.

Fred

Yeah,
I normally go into script/console

and just call the class name "Article"
is usually quite verbose

Hello,

I am having the same problem with acts_as_ferret, did you find a
solution?

Thanks,

Javi

Matthew Rudy Jacobs wrote: