hi list,
using models with a legacy database: class User < ActiveRecord::Base set_table_name 'ilt_insured_login_tbl' set_primary_key 'ilt_id' set_column_prefix 'ilt_'
has_many :policies, :foreign_key => 'ilp_ilt_id' end
class Policy < ActiveRecord::Base set_table_name 'ilp_insured_login_policy_tbl' set_primary_key 'ilp_ilt_id' set_column_prefix 'ilp_'
belongs_to :user, :foreign_key => 'ilt_id' end
.. i want to paginate a search query looking at both models, e.g.
@user_pages, @users = paginate :users, { :per_page => 15, :order => 'lower(ilt_email)', :conditions => ["lower(ilt_email) like lower(?) or lower(ilp_policy_num) like lower(?)", q, q], :include => :policies }
the API docs say that you cannot define conditions on an association if using eager loading, and accordingly i get errors when trying the above code
so, A: how would i perform such a query and B: how can i paginate the results?
thanks, jeff