Sha256: ae3847b72896329a73f39de30ac059e31aa32909d3930c202134b2b0305723ad
Contents?: true
Size: 721 Bytes
Versions: 7
Compression:
Stored size: 721 Bytes
Contents
module Controller module RansackConcern private # def collection_scope # @q = collection_scope_with_search_scopes(resource_class).ransack(params[:q]) # @q.result(distinct: true) # end def load_collection @q = collection_scope_with_search_scopes(collection_scope).ransack(params[:q]) @q.result(distinct: true) end def collection_scope_with_search_scopes(base_scope) final_scope = base_scope search_scopes.each do |scope| final_scope = final_scope.send(scope) end final_scope end def search_scopes return [] unless params.key?(:q) && params[:q].key?(:scopes) params[:q][:scopes].keys - ['unscoped'] end end end
Version data entries
7 entries across 7 versions & 1 rubygems