Platinum Partner

Display Rails Validation Error(s) In Non-defaults Places

Do you want to display rails validation error(s) in non-defaults places? Enjoy! 

App helper:  def errors_for(object, attribute)
    if errors = object.errors.on(attribute)
    errors = [errors] unless errors.is_a?(Array)
    return "
    " + errors.map {|e| "
  • › " + e + "
  • "}.join + "
" end end
App view (example) <%= errors_for @user, :login %> Code by radarek
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}