[Rails] Re: "Selecting" a calculated row / Using :select in the pagi

Iván Vega Rivera
Fri, 06 Jan 2006 20:01:43 -0000

Check
http://railsexpress.de/blog/articles/2005/11/06/the-case-for-piggy-backed-attributes
;-)

Kevin Olbrich wrote:
> Iv?n Vega Rivera wrote:
>
>> @story_pages, @stories = paginate :stories, {:per_page => 10,
:include
>> => ''user'', :select => ''timediff(now(),
story.created_on) as story_age''}
>>
>> ... to no avail.
>>
>
> I''m somewhat sure that paginate (and find for that matter)
don''t know
> what to do with the :select option.
>
> Try using find_by_sql()
>
>