Sha256: 1a3644d69f6c5c70e711b46277f67645930ab4feee5cdc1aaefaa1f0583e77ab
Contents?: true
Size: 582 Bytes
Versions: 7
Compression:
Stored size: 582 Bytes
Contents
# frozen_string_literal: true module Scribo class FormDrop < Liquid::Drop def initialize(model, attribute = nil) @model = model @attribute = attribute end attr_reader :model, :attribute def class_name model.class.name.gsub(/Drop$/, '') end def errors errors = if @model&.instance_variable_get('@object') @model.instance_variable_get('@object').errors else ::ActiveModel::Errors.new([]) end ::Scribo::ActiveModel::ErrorsDrop.new errors end end end
Version data entries
7 entries across 7 versions & 1 rubygems