In the rails console, we can prepend helper.
to helpers to use them, like so:
helper.time_ago_in_words(Time.now - 60*60*2)
but this doesn't work in the server console during a pry-byebug
debugging
How can I use a method like time_ago_in_words
after starting debugging with binding.pry
?
To test helper into console or debugger(i'm not 100% sure) try with:
ApplicationController.helpers.time_ago_in_words(Time.now - 60*60*2)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.