Sha256: 03c9bafce4886436e58c52d5384f4284fb66c01ff06ecb90ac3144c6e9bd3059

Contents?: true

Size: 413 Bytes

Versions: 1

Compression:

Stored size: 413 Bytes

Contents

class Alveole::Input::BaseComponent < ViewComponent::Base
  attr_reader :f

  def initialize(form, attribute, args = {})
    @f = form
    @attribute = attribute
    @args = args
    resource_name = form.object.class.to_s.underscore
    @id = "#{resource_name}_#{attribute.to_s.underscore}"
    @required = args[:required].presence || false
  end

  def errors?
    f.object.errors[@attribute].present?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alveole-1.0.0.pre.alpha.1 app/components/alveole/input/base_component.rb