Skip to content

Instantly share code, notes, and snippets.

@wrburgess
Created November 7, 2011 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wrburgess/1344105 to your computer and use it in GitHub Desktop.
Save wrburgess/1344105 to your computer and use it in GitHub Desktop.
concatenate a user model first and last name
# concatenate a user model's first and last name, include middle name or suffix if required
# may consider abbreviating the middle name
def fullname
if middlename.nil? then
fullname = firstname + ' ' + lastname
else
fullname = firstname + ' ' + middlename + ' ' + lastname
end
unless suffix.nil? then
fullname = fullname + ' ' + suffix
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment