diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-30 19:47:15 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-30 19:47:15 +0100 |
commit | ed8953f05638c43d9c1e62cf3d3ff7da158f4c20 (patch) | |
tree | ac0e481aaa45688dd7c6cecc9ec29b5f4906c585 /app/helpers/application_helper.rb | |
parent | cc2a6de28e676b5afb73f3fafb5b417301927cc9 (diff) |
Added a First Steps page.
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..de4d677 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,22 @@ module ApplicationHelper + + # nicely_joined_with_commata(['1', '2', '3', '4']) + # = '1, 2, 3 und 4' + # + def nicely_joined_with_commata(array_of_things) + if array_of_things.count == 1 + array_of_things.first.to_s + else + if array_of_things.count > 1 + output = array_of_things[0, array_of_things.count - 1].map{|item| item.to_s}.join(', ') + if I18n.locale == :de + output += ' und ' + else + output += ' and ' + end + output += array_of_things.last.to_s + end + end + end + end |