Commit e2b6c2fa21cad61340d7f0fae69f92c416c1ecd3
1 parent
0146694f
Exists in
master
and in
21 other branches
profile: Accept nil on short_name
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
app/models/profile.rb
| ... | ... | @@ -741,7 +741,11 @@ private :generate_url, :url_options |
| 741 | 741 | include ActionView::Helpers::TextHelper |
| 742 | 742 | def short_name(chars = 40) |
| 743 | 743 | if self[:nickname].blank? |
| 744 | - truncate self.name, :length => chars, :omission => '...' | |
| 744 | + if chars | |
| 745 | + truncate self.name, :length => chars, :omission => '...' | |
| 746 | + else | |
| 747 | + self.name | |
| 748 | + end | |
| 745 | 749 | else |
| 746 | 750 | self[:nickname] |
| 747 | 751 | end | ... | ... |