From 48490991ccfa0d199d0dc9e5b64b264bbe2dfb3f Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Thu, 22 Dec 2011 16:32:47 +0100 Subject: [PATCH] Added Customer#shortest_name --- stoptime.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stoptime.rb b/stoptime.rb index f891ff3..6afdd00 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -95,6 +95,11 @@ module StopTime::Models has_many :invoices has_many :time_entries, :through => :tasks + # Returns the short name if set, otherwise the full name. + def shortest_name + short_name.present? ? short_name : name + end + # Returns a list of tasks that have not been billed via in invoice. def unbilled_tasks tasks.all(:conditions => ["invoice_id IS NULL"], :order => "name ASC")