Files

Class/Module Index [+]

Quicksearch

SimpleForm::Components::Errors

Public Instance Methods

error() click to toggle source
# File lib/simple_form/components/errors.rb, line 4
def error
  error_text if has_errors?
end
has_errors?() click to toggle source
# File lib/simple_form/components/errors.rb, line 8
def has_errors?
  object && object.respond_to?(:errors) && errors.present?
end

Protected Instance Methods

error_method() click to toggle source
# File lib/simple_form/components/errors.rb, line 18
def error_method
  options[:error_method] || SimpleForm.error_method
end
error_text() click to toggle source
# File lib/simple_form/components/errors.rb, line 14
def error_text
  "#{options[:error_prefix]} #{errors.send(error_method)}".lstrip.html_safe
end
errors() click to toggle source
# File lib/simple_form/components/errors.rb, line 22
def errors
  @errors ||= (errors_on_attribute + errors_on_association).compact
end
errors_on_association() click to toggle source
# File lib/simple_form/components/errors.rb, line 30
def errors_on_association
  reflection ? object.errors[reflection.name] : []
end
errors_on_attribute() click to toggle source
# File lib/simple_form/components/errors.rb, line 26
def errors_on_attribute
  object.errors[attribute_name]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.