Permalink
Browse files

dont return "model.[name,title]" if their value is nil

  • Loading branch information...
1 parent 5bb4637 commit 9064d10382eadd1ed7a882ef40e2c6a65edfef2c @jonuts jonuts committed with Nov 9, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 app/helpers/main_helper.rb
@@ -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}"

0 comments on commit 9064d10

Please sign in to comment.