Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Devise, customizing the error messages?
- <% if @user.errors.any? %>
- <div id="error_explanation" class="error">
- <h2>Hold on!</h2>
- <ul>
- <% @user.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
- Email The User's Email cannot be blank
- Password The User's Password cannot be blank
- Fname The User's Fname is too short (minimum 1 characters)
- Lname The User's Lname is too short (minimum 1 characters)
- validates_presence_of(*attr_names)
- Configuration options:
- message - A custom error message (default is: "canβt be blank").
- activerecord:
- attributes:
- user:
- email: "your_way_of_email"
- password: "your_way_of_password"
- password_confirmation: "your_way_of_password_confirmation"
- <% if @user.errors.any? %>
- <div id="error_explanation" class="error">
- <h2>Hold on!</h2>
- <ul>
- <% @user.errors.each_key do |attr| %>
- <% @user.errors[attr].each do |msg| %>
- <% next if msg.nil? %>
- <li><%= msg %></li>
- <% end %>
- <% end %>
- </ul>
- </div>
- <% end %>
Add Comment
Please, Sign In to add comment