Forum: Ruby on Rails Pagination with include + conditions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
HOGANBP (Guest)
on 2005-11-15 21:43
(Received via mailing list)
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 method `scan' 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
This topic is locked and can not be replied to.