Time ago in words is returning me a stack error too deep error. Here how i call it.
<%= link_to time_ago_in_words(f.created_at), f %>
And here what i did, in article.helper
def time_ago_in_words(time_str)
time = time_str.to_time + (-Time.zone_offset(Time.now.zone))
"happened #{time_ago_in_words(time)} ago"
end
Can’t i redefine time_ago_in_words? because i also try the follow and it gave me the same kind of error
<%= link_to ctime_ago_in_words(f.created_at), f %>
def ctime_ago_in_words(time_str)
time = time_str.to_time + (-Time.zone_offset(Time.now.zone))
"happened #{ctime_ago_in_words(time)} ago"
end
Original:
You still have a function that repeatedly calls itself. I think you meant this instead for that last line: