Method: Satis::Forms::Builder#error_text

Defined in:
lib/satis/forms/builder.rb

#error_text(method) ⇒ Object

FIXME: These don’t work for relations or location_id, error is on location When using the association helper, we need to set a @assocation variable any other input should clear it



180
181
182
183
184
185
186
187
188
# File 'lib/satis/forms/builder.rb', line 180

def error_text(method)
  return if !has_error?(method) && !has_error?(method.to_s.gsub(/_id$/, ''))

  all_errors = @object.errors[method].dup
  all_errors += @object.errors[method.to_s.gsub(/_id$/, '')] if method.to_s.ends_with?('_id')

  tag.div(all_errors.uniq.join('<br />').html_safe,
          class: 'invalid-feedback')
end