1
votes

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' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/renderable.rb:39:in render' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/template.rb:73:in render_template' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/base.rb:256:in render' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/base.rb:367:in _render_with_layout' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_view/base.rb:254:in render' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/base.rb:1174:in render_for_file' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/base.rb:896:in render_without_benchmark' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in render' /usr/local/rubygems/gems/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in realtime' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in render' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/base.rb:868:in render_without_benchmark' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in render' /usr/local/rubygems/gems/gems/activesupport-2.2.2/lib/active_support/core_ext/benchmark.rb:8:in realtime' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/benchmarking.rb:51:in render' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in dispatch' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in dispatch_cgi' /usr/local/rubygems/gems/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in dispatch' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in process' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in synchronize' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in process' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:159:inprocess_client' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:158:in each' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:158:inprocess_client' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:285:in run' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:285:ininitialize' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel.rb:285:in new' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in run' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in each' /usr/local/rubygems/gems/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in run'

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?

1

1 Answers

1
votes

Profile.find(:first, :conditions => [ "user_id = ?", tabloid.user_id]) query returns nil so he cant execute name on it