Created
January 14, 2018 20:41
-
-
Save mmmpa/2e21b678cf598c1f071fa0fa83768f22 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Formtastic | |
module Inputs | |
module Base | |
module Errors | |
# override | |
def error_sentence_html | |
error_class = builder.default_inline_error_class | |
template.content_tag(:p, full_message_errors.to_sentence.html_safe, :class => error_class) | |
end | |
def full_message_errors | |
return [] unless object && object.respond_to?(:errors) | |
errors = error_keys.each_with_object([]) do |at, a| | |
e = object.errors.full_messages_for(at) | |
a.push(e) if e.present? | |
end | |
errors.flatten.compact.uniq | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment