Sha256: f58b0f51eee3b5bf73ec27909e1b1fb7fa19f74bb04cc66798e7cbf53b4422e3
Contents?: true
Size: 1001 Bytes
Versions: 35
Compression:
Stored size: 1001 Bytes
Contents
# frozen_string_literal: true module LinkedRails module Model module Indexable extend ActiveSupport::Concern module ClassMethods def collection_from_parent(params) parent = parent_from_params(params, params[:user_context]) return if parent.blank? collection_name = collection_from_parent_name(parent, params) parent.send(collection_name, params) if collection_name end def root_collection(**params) return unless root_collection? default_collection_option(:collection_class).collection_or_view( default_collection_options, params ) end private def collection_from_parent_name(parent, _params) collection_name = "#{name.demodulize.underscore}_collection" collection_name if parent.respond_to?(collection_name, true) end def root_collection? true end end end end end
Version data entries
35 entries across 35 versions & 1 rubygems