Simplifying Rails views with pluralize"2 User(s) been updated."
This is a silly problem that I kept running into before I found out about
Now, instead of having to do a conditional checking for number of users and printing the line based on that number, I can do this using
Or, if I want to use the Ruby version of
pluralize(or, more accurately, the ActiveSupport version):
@usersis more than one, outputs "Users". If
@usersis 1, outputs "User". This is nice for when you don't want to display the number, just the pluralized word (i.e. "Users updated").