Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 85916045f797d7a916d49cb558a98f24c09e4811 1 parent f77014c
@dazoakley authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 app/models/customer.rb
View
6 app/models/customer.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.