Sha256: d1dd0b482fea0e79cd080ae6f9d302e8cab3b1f8be852f6d97633a75885c2fc1
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
module SimpleForm module Components module Errors include SimpleForm::Helpers::HasErrors def error enabled_error end def error_tag options[:error_tag] || SimpleForm.error_tag end def error_text if options[:error_prefix] options[:error_prefix] + " " + errors.send(error_method) else errors.send(error_method) end end def error_method options[:error_method] || SimpleForm.error_method end def error_html_options html_options_for(:error, [SimpleForm.error_class]) end protected def enabled_error template.content_tag(error_tag, error_text, error_html_options) if has_errors? end def disabled_error nil end def errors @errors ||= (errors_on_attribute + errors_on_association).compact end def errors_on_attribute object.errors[attribute_name] end def errors_on_association reflection ? object.errors[reflection.name] : [] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
simple_form-1.5.2 | lib/simple_form/components/errors.rb |
simple_form-1.5.1 | lib/simple_form/components/errors.rb |
simple_form-1.5.0 | lib/simple_form/components/errors.rb |