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:

<%= link_to record.comments, :action => ‘edit’, :id => record
%>
4:
5:
6: <%= link_to “View Images (#{record.images.size.to_s})”,
{:controller => ‘design’, :action => ‘workspace’, :design_id =>
record} %>
7:
8:
9:
#{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:inconst_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:incompute_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:inklass’
#{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:ininitialize’
#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/
associations.rb:998:in new' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/ associations.rb:998:inimages’
#{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:insend’
#{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:inrender_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:inrender_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:inrender’
#{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:inbenchmark’
#{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:inrender_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:incompile_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:inrender_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:inrender_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:inrender_without_benchmark’
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/
benchmarking.rb:51:in render' /usr/lib/ruby/1.8/benchmark.rb:293:inmeasure’
#{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/
benchmarking.rb:51:in render' #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ base.rb:1121:inperform_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:incall_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:incall’
#{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:incall_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:incall’
#{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:incall_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:incall_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:inperform_action_without_rescue’
/usr/lib/ruby/1.8/benchmark.rb:293:in measure' #{RAILS_ROOT}/vendor/rails/actionpack/lib/action_controller/ benchmarking.rb:68:inperform_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:inperform_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:inperform_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:inprocess_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:insass_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:inprocess’
#{RAILS_ROOT}/vendor/rails/railties/lib/dispatcher.rb:39:in
dispatch' #{RAILS_ROOT}/vendor/rails/railties/lib/fcgi_handler.rb:168:inprocess_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:inwith_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:ineach_cgi’
/usr/local/lib/site_ruby/1.8/fcgi.rb:597:in each' /usr/local/lib/site_ruby/1.8/fcgi.rb:597:ineach_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:inprocess!’
#{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 B. http://agileconsultingllc.com
[email protected]