Sha256: 414befaa170d4e3e00be841afe671acbc3f41b4d6f551a044391b5cc6f68592d
Contents?: true
Size: 938 Bytes
Versions: 3
Compression:
Stored size: 938 Bytes
Contents
# frozen_string_literal: true module Katalyst module Tables module Selectable class FormComponent < ViewComponent::Base # :nodoc: attr_reader :id, :primary_key def initialize(table:, id: nil, primary_key: :id) super @table = table @id = id @primary_key = primary_key if @id.nil? table_id = table.try(:id) raise ArgumentError, "Table selection requires an id" if table_id.nil? @id = "#{table_id}_selection" end end def inspect "#<#{self.class.name} id: #{id.inspect}, primary_key: #{primary_key.inspect}>" end private def form_controller FORM_CONTROLLER end def form_target(value) "#{FORM_CONTROLLER}-target=#{value}" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems