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

Iván Vega Rivera ivanvega at gmail.com
Fri Jan 6 20:02:50 GMT 2006


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()
>
>   




More information about the Rails mailing list