Displaying 2 results from an estimated 2 matches for "sort_clause".
Did you mean:
sat_clause
2006 Mar 07
1
Find By SQL + multiple tables
..._time DESC
If I type that into an SQL program it works fine, if I try and use the
following in RoR:
Bugsheet.find_by_sql["SELECT bugsheet.*, bugcomplete.bc_time FROM
bugsheet, bugcomplete WHERE bugsheet.bs_id = bugcomplete.bc_id AND
bugsheet.bs_patchrel
like ? ORDER BY ?", @criteria, sort_clause]
It returns an empty array. I have checked that @criteria and sort_clause
are populated using the breakpointer.
Is it because I am selecting from two tables using a single models
.find_by_sql?
I thought about using left join:
SELECT bugsheet.bs_cdate, bugcomplete.bc_time FROM bugsheet left jo...
2005 Aug 04
1
Pagination and :include (eager associations)
I have tried to use eager association with pagination, but
the :include option is not supported:
Here''s the one-line pagination call without :include
@link_pages, @links = paginate :link, :per_page => 10, :order_by
=> sort_clause
and here the work around, using the "classic" method
# @link_pages = Paginator.new self, Link.count, 10, @params[''page'']
# @links = Link.find_all nil, sort_clause, @link_pages.current.to_sql
# limit = @link_pages.current.to_sql.first
# offset = @link_pages....