Hello,
Following this post''s instructions (http://railspikes.com/tags/date)
I''m
trying to define a Date format like this:
ActiveSupport::CoreExtensions::Date::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.-
http://jdugarte.blogspot.com/
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---