Sha256: c3bf4a163c367dc6c01f28f39c3fe628048b149d56500ebaa5d73259beeaff6b
Contents?: true
Size: 658 Bytes
Versions: 7
Compression:
Stored size: 658 Bytes
Contents
module DataTable module Mongoid module ClassMethods def _find_objects params, fields, search_fields self.where(_where_conditions params[:sSearch], search_fields). order_by(_order_by_fields params, fields). paginate :page => _page(params), :per_page => _per_page(params) end def _where_conditions raw_query, search_fields return if (query = raw_query.gsub(/\//, "")).blank? {"$or" => search_fields.map {|field| {field => /#{query}/i} }} end def _order_by_fields params, fields [fields[params[:iSortCol_0].to_i], params[:sSortDir_0]] end end end end
Version data entries
7 entries across 7 versions & 1 rubygems