- model.find(:all, :conditions => options[:conditions],
- :order => options[:order_by] || options[:order],
- :joins => options[:join] || options[:joins], :include => options[:include],
- :select => options[:select], :limit => options[:per_page],
- :group => options[:group], :offset => paginator.current.offset)
+ collection = model.joins(options[:join] || options[:joins])
+ collection = collection.where(options[:conditions])
+ collection = collection.order(options[:order_by] || options[:order])
+ collection = collection.includes(options[:include])
+ collection = collection.group(options[:group])
+
+ if options[:select]
+ collection = collection.select(options[:select])
+ end
+
+ collection.offset(paginator.current.offset).limit(options[:per_page])