How do I add multiple conditions to a paginated list? I have:
@post_pages, @posts = paginate(:posts,
:per_page => 10,
:conditions => [ ‘(title) OR (body)
LIKE ?’, ‘%’ + params[:query] + ‘%’],
:order => ‘end_date’)
I would like to add a:
‘end_date >= NOW()’
to the mix. I can get it to work if it’s the only condition. But I can’t
get both of them to play nice. I’m also getting a “cannot convert nil
into String” exeption when I click on the “Next” link. View code below.
<%= link_to ‘Previous page’, { :page => @post_pages.current.previous }
if @post_pages.current.previous %>
<%= link_to ‘Next page’, { :page => @post_pages.current.next } if
@post_pages.current.next %>