How to decorate validations in rails

I have a simple flyover application that runs validataes_presence_of.

Validation makes each text field limited. I just want the error messages displayed on top.

How can I make these changes or color changes to check

+1
source share
3 answers

Rails applications save CSS in [application_root]/public/stylesheets. The new rails application will have a file with a name default.cssin this directory. This file contains the following:

#errorExplanation {
  width: 400px;
  border: 2px solid red;
  padding: 7px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  background-color: #f0f0f0;
}

#errorExplanation h2 {
  text-align: left;
  font-weight: bold;
  padding: 5px 5px 5px 15px;
  font-size: 12px;
  margin: -7px;
  background-color: #c00;
  color: #fff;
}

#errorExplanation p {
  color: #333;
  margin-bottom: 0;
  padding: 5px;
}

#errorExplanation ul li {
  font-size: 12px;
  list-style: square;
}

If you play with the values โ€‹โ€‹of some parameters here - in particular border- you may find something that looks more like your taste.

+4
source
0

I would suggest looking at Formtastic . It is easy to configure, works great with applications like scaffold and has some nice clean HTML and CSS.

0
source

All Articles