Created
February 2, 2015 21:06
-
-
Save kangkyu/90bda70e68af80b6274b to your computer and use it in GitHub Desktop.
dismissible form error message in Rails
This file contains hidden or 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
- if @task.errors.any? | |
= content_tag(:div, class: ["alert", "alert-danger", "alert-dismissible"], role: "alert", id: "error-explanation") do | |
= content_tag(:button, class: "close", type: "button", "data-dismiss"=> "alert") do | |
= content_tag(:span, escape_once("×"), "aria-hidden"=> "true") | |
= content_tag(:span, "Close", class: "sr-only") | |
%p= pluralize(@task.errors.count, "error") + " prohibited this user from being saved" | |
%ul | |
- @task.errors.full_messages.each do |msg| | |
%li= msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment