CSS-Style Time_Ago_in_words-Schienen
-
14-11-2019 - |
Frage
Ich habe mich gefragt, was die beste Lösung für das Anpassen der Rails Helpers: Time_Ago_in_words, damit ich Dinge tun könnte: generasacodicetagpre.
oder wie das Layout standardmäßig aussieht?
danke
Lösung
I would just create a helper that splits the result of time_ago_in_words on spaces and returns the array of words. Then you can format them however you want.
Andere Tipps
Instead of the method time_ago_in_words
, you can use distance_of_time_in_words, which accepts locale in the option array: create a new locale where you can define "hours" with "hours", etc... and give it to distance_of_time_in_words
. It should work, but I'm not sure how will be handled the HTML tags.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow