For example, why are the date helpers written like this:
time_ago_in_words(@from_time)
Instead of like this:
@from_time.time_ago_in_words
Is this a clear design error / inconsistency? Or is there some reason for this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Great question!
Most of the helpers are for selecting dates / times.
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html
I’m guessing whoever wrote it wanted a couple of util methods and so added time_ago_in_words and distance_of_time_in_words to their helper with the selects.
As time_ago_in_words and distance_of_time_in_words are presentaton focused (i.e. you may want to localize it) the developer maybe felt that the helper isn’t a bad place for them.