Pagination with include + conditions


#1

This really does look like a bug so I’m going to post it… but has
anyone else come across this? (Sorry for the repeat, but I didn’t get
any feedback either way so I’m trying again.)

This code:

@task_pages, @tasks = paginate :task, :conditions=>[“tasks.project_id =
?”, params[‘pid’]], :include=>[:tasktimes], :per_page => 10

This results in “NoMethodError: private method `scan’ called for…”

Here’s a breakpoint trace I did… I placed a breakpoint in
activerecord/associations#include_eager_conditions?

Executing break point at
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/ass
ociations.rb:962 in include_eager_conditions?' irb(Task):001:0> options options => {:order=>nil, :select=>nil, :conditions=>["tasks.project_id = ?", 9], :offset=>0, :include=>[:tasktimes], :limit=>10, :joins=>nil} irb(Task):002:0> options[:conditions] options[:conditions] => ["tasks.project_id = ?", 9] irb(Task):003:0> options[:conditions].scan options[:conditions].scan NoMethodError: private methodscan’ called for [“tasks.project_id = ?”,
9]:Array

Bug? Or am I just not using this right?

This assumes:

Task :has_many :tasktimes

Brian H.
Web D.
Learning & Technology Services
Schofield 3-B
University of Wisconsin-Eau Claire
715 836 3585
removed_email_address@domain.invalid