Displaying 2 results from an estimated 2 matches for "story_pages".
2006 Jan 06
4
"Selecting" a calculated row / Using :select in the paginate method
Hi,
I was trying to use the :select parameter to select a calculated row,
but it appears that the parameter is not picked 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 calculati...
2006 Apr 23
0
Using Paginator outside of controllers
I am doing this in _messages.rthml:
<% shout_pages = Paginator.new self,
Shout.length,
30,
@params[''page''] %>
<% shouts = Shout.find :all,
:order => "timestamp desc",
:limit => @story_pages.items_per_page,
:offset => @story_pages.current.offset %>
I am calling the _messages.rhtml with:
<%= render :partial => ''/shout/messages'' %>
However, I keep getting "uninitialized constant Paginator"
Is this normal? Are you sup...