Skip to content

Instantly share code, notes, and snippets.

@scottwater
Created March 21, 2011 16:17
Show Gist options
  • Save scottwater/879712 to your computer and use it in GitHub Desktop.
Save scottwater/879712 to your computer and use it in GitHub Desktop.
def friendly_name(user)
temp_name = if user.first_name.blank? && user.last_name.blank?
user.email
elsif user.first_name.blank?
user.last_name
elsif user.last_name.blank?
user.first_name
else
"#{user.first_name} #{user.last_name}"
end
"#{temp_name}'s"
end
@scottwater
Copy link
Author

@chris - nevermind, I get what you meant about them both being on the model. Bah...consider it committed. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment