Sha256: e082f7275109849cb16ba183da4b9c44dbce1bbf8024179593bd0740982b9f50
Contents?: true
Size: 991 Bytes
Versions: 1
Compression:
Stored size: 991 Bytes
Contents
# frozen_string_literal: true module Katalyst module Tables module Collection # Entry point for creating a collection from an array for use with table components. class Array include Core include Filtering def self.with_params(params) new.with_params(params) end def model items.first&.class || ActiveRecord::Base end def model_name @model_name ||= items.first&.model_name || ActiveModel::Name.new(Object, nil, "record") end def with_params(params) # test support params = ActionController::Parameters.new(params) unless params.is_a?(ActionController::Parameters) self.attributes = params.permit(self.class.permitted_params) self end def inspect "#<#{self.class.name} @attributes=#{attributes.inspect} @model_name=\"#{model_name}\" @count=#{items&.count}>" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
katalyst-tables-3.1.0 | app/models/katalyst/tables/collection/array.rb |