Hi everybody.
After DHHs talk at RailsConf yesterday, it’s essential that some of
you can rectify this patch for ruby on Rails
Please help me an have a look at
http://dev.rubyonrails.org/ticket/9587
Thanks!
Jesper Rønn-Jensen
blog: www.justaddwater.dk
=====
ActiveRecord::Errors has a placeholder (@@default_error_messages) for
messages that can be overridden.
Just the same way, the hardcoded time strings should be easily
overridden without breaking or re-implementing the logic in
distance_of_time_in_words.
This patch creates a new placeholder for the hardcoded strings:
@@time_messages = {
:less_than_x_seconds => “less than %d seconds”,
:half_a_minute => “half a minute”,
…
}
Now you are able to overwrite with
Helpers::DateHelpers::time_messages[:less_than_x_seconds] = “an
instant”
or similar. I also added some lines of documentation for overriding,
as well as ran the tests which pass.
Please
a) verify that this works for you
b) vote +1 for it
c) try it out in your environment