From 9064d10382eadd1ed7a882ef40e2c6a65edfef2c Mon Sep 17 00:00:00 2001 From: jonah honeyman Date: Mon, 9 Nov 2009 20:08:14 +0800 Subject: [PATCH] dont return "model.[name,title]" if their value is nil --- app/helpers/main_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/main_helper.rb b/app/helpers/main_helper.rb index b458cd8..10745fe 100644 --- a/app/helpers/main_helper.rb +++ b/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}"