I’m working on a little CMS that has been custom written in Ruby, the website is running using Mongrel.
Unfortunately I am not at all familiar with Ruby. A part of the website has recently stopped working (not in connection with any updates or so, so I am unsure what was the cause)
Checking the “production.log” in the rails logs shows the following:
ActionView::TemplateError (undefined method `name’ for nil:NilClass)
on line #25 of app/views/static/frontpage.rhtml: 22: <%
Tabloid.find(:all, :limit => 4, :order =>’date DESC’).each do
|tabloid|%> 23: 24: <%= link_to tabloid.title, :controller =>
‘tabloid’, :action => ‘show’, :id => tabloid.id %> 25:<%=
tabloid.date.strftime(“%d of %B, %Y”) %> By: <%= Profile.find(:first,
:conditions => [ “user_id = ?”, tabloid.user_id]).name %> <%=
Profile.find(:first, :conditions => [ “user_id = ?”,
tabloid.user_id]).surname %>26:
<%=
RedCloth.new(truncate(tabloid.texto, 250)).to_html %>27: <% if
tabloid.texto.size > 250 %> 28:<%= link_to “Read more >”,
:controller => ‘tabloid’, :action => ‘show’, :id => tabloid.id %>app/views/static/frontpage.rhtml:25 app/views/static/frontpage.rhtml:22:in `each' app/views/static/frontpage.rhtml:22 /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/renderable.rb:39:in
send'render’
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/renderable.rb:39:in
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/template.rb:73:in
render_template'render’
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/base.rb:256:in
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/base.rb:367:in
_render_with_layout'render’
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/base.rb:254:in
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/base.rb:1174:in
render_for_file'render_without_benchmark’
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/base.rb:896:in
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in
render'realtime’
/usr/local/rubygems/gems/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in
render'render_without_benchmark’
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/base.rb:868:in
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in
render'realtime’
/usr/local/rubygems/gems/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in
render'dispatch’
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in
dispatch_cgi'dispatch’
/usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in
process'synchronize’
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in
process'process_client’
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:158:ineach'process_client’
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:285:inrun'initialize’
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:285:innew'run’
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
each'run’
/usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
etc.
The Mongrel logs actually haven’t updated in a while. Any pointers as to what the problem is or where I should continue digging?
Profile.find(:first, :conditions => [ "user_id = ?", tabloid.user_id])query returnsnilso he cant executenameon it