ActionView::TemplateError

Hi,

I have a strange problem that only occurs on the production server. I've been banging my head for hours trying to figure it out with no success. Below is a copy of the error from the production log.

ActionView::TemplateError (Expected /www/rails_apps/scanlan/current/ public/../config/../app/models/image.rb to define Image) on line #6 of app/views/admin/design/_record.rhtml: 3: <td><%= link_to record.comments, :action => 'edit', :id => record %></td> 4: <td> 5: 6: <%= link_to "View Images (#{record.images.size.to_s})", {:controller => 'design', :action => 'workspace', :design_id => record} %> 7: 8: </td> 9: <td class="buttons">

    #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/ dependencies.rb:249:in `load_missing_constant'     #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/ dependencies.rb:452:in `const_missing'     #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/ dependencies.rb:464:in `const_missing'     #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/base.rb: 1386:in `compute_type'     #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/ reflection.rb:125:in `send'     #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/ reflection.rb:125:in `klass'     #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/ associations/has_many_association.rb:174:in `construct_sql'     #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/ associations/has_many_association.rb:6:in `initialize'     #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/ associations.rb:998:in `new'     #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/ associations.rb:998:in `images'     #{RAILS_ROOT}/app/views/admin/design/_record.rhtml:6:in `_run_rhtml_47app47views47admin47design47_record46rhtml'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 328:in `send'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 328:in `compile_and_render_template'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 303:in `render_template_old'     #{RAILS_ROOT}/vendor/plugins/haml/lib/haml/template.rb:121:in `render_template'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 263:in `render_file'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 278:in `render_without_haml'     #{RAILS_ROOT}/vendor/plugins/haml/lib/haml/helpers/ action_view_mods.rb:17:in `render'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/partials.rb: 60:in `render_partial'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:30:in `benchmark'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/partials.rb: 59:in `render_partial'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 289:in `render_without_haml'     #{RAILS_ROOT}/vendor/plugins/haml/lib/haml/helpers/ action_view_mods.rb:17:in `render'     #{RAILS_ROOT}/app/views/admin/design/list.rhtml:21:in `_run_rhtml_47app47views47admin47design47list46rhtml'     #{RAILS_ROOT}/app/views/admin/design/list.rhtml:20:in `each'     #{RAILS_ROOT}/app/views/admin/design/list.rhtml:20:in `_run_rhtml_47app47views47admin47design47list46rhtml'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 328:in `send'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 328:in `compile_and_render_template'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 303:in `render_template_old'     #{RAILS_ROOT}/vendor/plugins/haml/lib/haml/template.rb:121:in `render_template'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_view/base.rb: 263:in `render_file'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ base.rb:855:in `render_file'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ base.rb:760:in `render_with_no_layout'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ layout.rb:250:in `render_without_benchmark'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:51:in `render'     /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:51:in `render'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ base.rb:1121:in `perform_action_without_filters'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:623:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:625:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:629:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:438:in `call'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:628:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:625:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:629:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:438:in `call'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:628:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:629:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:438:in `call'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:628:in `call_filter'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:657:in `perform_action_without_benchmark'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue'     /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:68:in `perform_action_without_rescue'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ rescue.rb:125:in `perform_action_without_caching'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ caching.rb:625:in `perform_action'     #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/ query_cache.rb:99:in `cache'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ caching.rb:624:in `perform_action'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ base.rb:473:in `send'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ base.rb:473:in `process_without_filters'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ filters.rb:652:in `process_without_session_management_support'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ session_management.rb:122:in `sass_old_process'     #{RAILS_ROOT}/vendor/plugins/haml/lib/sass/plugin.rb:116:in `process'     #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ base.rb:326:in `process'     #{RAILS_ROOT}/vendor/rails/railties/lib/dispatcher.rb:39:in `dispatch'     #{RAILS_ROOT}/vendor/rails/railties/lib/fcgi_handler.rb:168:in `process_request'     #{RAILS_ROOT}/vendor/rails/railties/lib/fcgi_handler.rb:143:in `process_each_request!'     #{RAILS_ROOT}/vendor/rails/railties/lib/fcgi_handler.rb:109:in `with_signal_handler'     #{RAILS_ROOT}/vendor/rails/railties/lib/fcgi_handler.rb:142:in `process_each_request!'     /usr/local/lib/site_ruby/1.8/fcgi.rb:600:in `each_cgi'     /usr/local/lib/site_ruby/1.8/fcgi.rb:597:in `each'     /usr/local/lib/site_ruby/1.8/fcgi.rb:597:in `each_cgi'     #{RAILS_ROOT}/vendor/rails/railties/lib/fcgi_handler.rb:141:in `process_each_request!'     #{RAILS_ROOT}/vendor/rails/railties/lib/fcgi_handler.rb:55:in `process!'     #{RAILS_ROOT}/vendor/rails/railties/lib/fcgi_handler.rb:25:in `process!'     /www/rails_apps/scanlan/current/public/dispatch.fcgi:24

Rendering /www/rails_apps/scanlan/current/public/../config/../public/ 500.html (500 Internal Server Error)

Image.rb does define the Image model and when running script/server on my local box it works no problems at all. Feedback is greatly appreciated.

Thanks in advance, Johnny.

I still havn't solved this :frowning:

Any help greatly appreciated!

The file needs to be app/models/image.rb (note the lowercase name) and define the class Image (capitalized class name constant).

If your local server's filesystem is case-insensitive, app/models/Image.rb and app/models/image.rb are effectively the same as APP/mOdEls/iMAge.Rb. I suspect that your production server isn't so lenient with filenames.

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com