Permalink
Browse files

Make the customer#short_code a bit more reliable...

  • Loading branch information...
1 parent f77014c commit 85916045f797d7a916d49cb558a98f24c09e4811 @dazoakley committed Apr 8, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 app/models/customer.rb
View
@@ -10,15 +10,15 @@ class Customer < ActiveRecord::Base
validates_uniqueness_of :company, :scope => [:first_name, :last_name]
def short_code
- str = ""
+ str = []
str << "#{self.company}" unless self.company.blank?
if !self.company.blank? and !( self.first_name.blank? or self.last_name.blank? )
- str << " - "
+ str << "-"
end
str << "#{self.first_name} " unless self.first_name.blank?
str << "#{self.last_name}" unless self.last_name.blank?
- str
+ str.join(' ')
end
end

0 comments on commit 8591604

Please sign in to comment.