Forum: Ruby on Rails Newbie question about using helpers in controllers

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Alex MacCaw (Guest)
on 2006-04-22 17:06
I'm trying to display a list of pages in xml. I want to change
page.update_at to distance_of_time_in_words_to_now. However whenever I
run it I get an error saying:
undefined method `distance_of_time_in_words_to_now'
I know I can just go the rails api and copy the source, but there must
be another way.

def list
@page = Page.find(:all, :order => "updated_at desc")

for page in @page
page.updated_at = distance_of_time_in_words_to_now(page.updated_at)

render :xml => @page.to_xml
D. Taylor S. (Guest)
on 2006-04-22 19:10
(Received via mailing list)
This should help you out. It has its limitations but for most purposes
what you are looking for. Especially useful for chaining helpers in an
action in your controller.

D. Taylor S.,
Reality Technician
This topic is locked and can not be replied to.