Sha256: 02f8e4d8bbb55e4057fb4709588727a67ca2b03873f113545e6e512b41d6ad39
Contents?: true
Size: 874 Bytes
Versions: 12
Compression:
Stored size: 874 Bytes
Contents
# frozen_string_literal: true class Fields::FieldPresenter < ApplicationPresenter def required @model.validations&.presence end alias required? required def target @options[:target] end def value target&.read_attribute(@model.name) end def value_for_preview target&.read_attribute(@model.name) end def access_readonly? target.class.attr_readonly?(@model.name) end def access_hidden? target.class.attribute_names.exclude?(@model.name.to_s) && target.class._reflections.keys.exclude?(@model.name.to_s) end def access_read_and_write? !access_readonly? && (target.class.attribute_names.include?(@model.name.to_s) || target.class._reflections.key?(@model.name.to_s)) end def id "form_field_#{@model.id}" end def nested_form_field? false end def multiple_nested_form? false end end
Version data entries
12 entries across 12 versions & 1 rubygems