# LoadError (Expected model.rb to define Model)

**URL:** <https://www.ruby-forum.com/t/loaderror-expected-model-rb-to-define-model/139744>\
**Category:** Rails\
**Created:** [June 6, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/loaderror-expected-model-rb-to-define-model/139744 "2008-06-06T17:24:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathan\_stegall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jonathan\_stegall](https://www.ruby-forum.com/u/jonathan_stegall)\
**Post date:** [June 6, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/loaderror-expected-model-rb-to-define-model/139744/1 "2008-06-06T17:24:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jonathan\_stegall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jonathan\_stegall](https://www.ruby-forum.com/u/jonathan_stegall)\
**Post date:** [June 7, 2008, 8:15pm UTC](https://www.ruby-forum.com/t/loaderror-expected-model-rb-to-define-model/139744/2 "2008-06-07T20:15:34Z")

</div>

On 6 Jun 2008, at 16:23, jonathan stegall wrote:

> 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):

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

---

<div class="post-metadata">

**Author:** ![jonathan\_stegall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jonathan\_stegall](https://www.ruby-forum.com/u/jonathan_stegall)\
**Post date:** [June 7, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/loaderror-expected-model-rb-to-define-model/139744/3 "2008-06-07T21:15:59Z")

</div>

> On 6 Jun 2008, at 16:23, jonathan stegall wrote:
> 
> > 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):

Yeah,  
I normally go into script/console

and just call the class name “Article”  
is usually quite verbose

===================

ruby script/console  
Loading development environment.

> > User  
> > MissingSourceFile: no such file to load – ferret

===================  
from /usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’

---

<div class="post-metadata">

**Author:** ![jonathan\_stegall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jonathan\_stegall](https://www.ruby-forum.com/u/jonathan_stegall)\
**Post date:** [June 24, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/loaderror-expected-model-rb-to-define-model/139744/4 "2008-06-24T22:01:36Z")

</div>

Hello,

I am having the same problem with acts\_as\_ferret, did you find a  
solution?

Thanks,

Javi

Matthew R. Jacobs wrote:

> > On 6 Jun 2008, at 16:23, jonathan stegall wrote:
> > 
> > > 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):
> 
> Yeah,  
> I normally go into script/console
> 
> and just call the class name “Article”  
> is usually quite verbose
> 
> ===================
> 
> ruby script/console  
> Loading development environment.
> 
> > > User  
> > > MissingSourceFile: no such file to load – ferret
> 
> ===================  
> from /usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> `gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’
