Skip to content

Instantly share code, notes, and snippets.

@mmmpa
Created January 14, 2018 20:41
Show Gist options
  • Save mmmpa/2e21b678cf598c1f071fa0fa83768f22 to your computer and use it in GitHub Desktop.
Save mmmpa/2e21b678cf598c1f071fa0fa83768f22 to your computer and use it in GitHub Desktop.
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