Skip to content

Commit

Permalink
dont return "model.[name,title]" if their value is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
jonuts authored and sferik committed Nov 9, 2009
1 parent 5bb4637 commit 9064d10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/helpers/main_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module MainHelper
def object_name(object)
if object.nil?
nil
elsif object.respond_to?(:name)
elsif object.respond_to?(:name) && object.name
object.name
elsif object.respond_to?(:title)
elsif object.respond_to?(:title) && object.title
object.title
else
"#{object.class.to_s} ##{object.id}"
Expand Down

0 comments on commit 9064d10

Please sign in to comment.