Module: Formular::Element::Modules::Error::InstanceMethods

Defined in:
lib/formular/element/modules/error.rb

Overview

options functionality (same as SimpleForm): options == false NO ERROR regardless of model errors options == String return the string, regardless of model errors

Instance Method Summary collapse

Instance Method Details

#error_textObject



16
17
18
19
20
21
# File 'lib/formular/element/modules/error.rb', line 16

def error_text
  return unless has_errors?

  text = has_custom_error? ? options[:error] : errors_on_attribute.send(error_method)
  html_escape(text)
end

#has_errors?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/formular/element/modules/error.rb', line 23

def has_errors?
  options[:error] != false && (has_custom_error? || has_attribute_errors?)
end