Sha256: 5a221391f34b32603af23f76ea62fc1a140db2b7b6a5702c82c2efa7ef83fca4
Contents?: true
Size: 820 Bytes
Versions: 7
Compression:
Stored size: 820 Bytes
Contents
# frozen_string_literal: true require 'ransack' module AdministrateRansack module Searchable def scoped_resource @ransack_results = super.ransack(params[:q]) @ransack_results.result(distinct: true) end # ref => https://github.com/thoughtbot/administrate/blob/v0.15.0/app/helpers/administrate/application_helper.rb#L54-L60 def sanitized_order_params(page, current_field_name) collection_names = page.item_includes + [current_field_name] association_params = collection_names.map do |assoc_name| { assoc_name => %i[order direction page per_page] } end params.permit(:search, :id, :page, :per_page, association_params, q: {}) end class << self def prepended(base) base.helper_method :sanitized_order_params end end end end
Version data entries
7 entries across 7 versions & 1 rubygems