class Client has_many :placements class Placement belongs_to :clients
class Client... def current_client if Placement.find(:first, :conditions => ["discharge_date IS NULL AND accepted IS true \ AND client_id = ?", self]) return true else return false end end
using paginator gem...in my clients_controller.rb
@pager = ::Paginator.new(Client.count( :conditions => cond.to_sql), 12) do |offset, per_page| Client.find(:all, :limit => per_page, :conditions => cond.to_sql, :include => :case_manager, :order => sortby, :offset => offset) end
is there any way that I can 'sort' by current_client (not a table field) and paginate properly?
Craig