search for: story_age

Displaying 1 result from an estimated 1 matches for "story_age".

Did you mean: storage
2006 Jan 06
4
"Selecting" a calculated row / Using :select in the paginate method
...up by the paginate method. I want to add the following to the select statement: timediff(now(), created_on) as age So I tried: @story_pages, @stories = paginate :stories, {:per_page => 10, :include => ''user'', :select => ''timediff(now(), story.created_on) as story_age''} ... to no avail. I know I can create a method named "age" for the story model that can retrieve that calculation, but that''s a query for each element, so it''s very undesirable. In case you''re wondering why I don''t calculate the "age...