Hello,
Following this post's instructions (http://railspikes.com/tags/date) I'm trying to define a Date format like this:
ActiveSupport::CoreExtensions::Conversions::DATE_FORMATS.update(:date_ago
=> lambda { |date| date.strftime('%a, %d %b, %I:%M%p') + ' (' +
time_ago_in_words(date) + ')' } )
But it keeps giving this error message:
undefined method 'time_ago_in_words' for main:Object
It works if I do it as a application helper:
# application_helper.rb def fecha_completa(date) date.strftime('%a, %d %b, %I:%M%p') + ' (' + time_ago_in_words(date) + ')' end
but not as a Date format.
What am I doing wrong? Is this not possible?
Thanks,
Jesús Dugarte.-