Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Wow, what a snafu. Object.present? didn't perform as expected.

What I get for writing my own helpers similar but not identical to rail 3 :)
  • Loading branch information...
commit 278b8e3cd72e39812cfb8d63b9fb403db42cddf9 1 parent 4235e60
@sudara authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  app/helpers/application_helper.rb
View
2  app/helpers/application_helper.rb
@@ -54,7 +54,7 @@ def track_name_for(asset, length=40)
# in the middle of an entity ex.: truncate("this & that",9) => "this &am..."
# though it will not be the exact length.
def awesome_truncate(text, length = 30, truncate_string = "...")
- return unless text.present?
+ return if text.blank?
l = length - truncate_string.mb_chars.length
text.mb_chars.length > length ? text[/\A.{#{l}}\w*\;?/m][/.*[\w\;]/m] + truncate_string : text
end
Please sign in to comment.
Something went wrong with that request. Please try again.