Flowdock

Notes posted by singsai

RSS feed
January 8, 2013 - (v3.0.0 - v3.2.8)
0 thanks

Minor edit of pluralize_without_count

patrickberkeley’s method works great. I corrected the grammar a bit for inflection (the singular error).

application_helper.rb

def pluralize_without_count(count, noun, text = nil)
  if count != 0
    count == 1 ? "an #{noun}#{text}" : "#{noun.pluralize}#{text}"
  end
end

This should work in much older versions of Rails also.