Skip to content

Commit

Permalink
Add an example of sexy validations usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Bozhidar Batsov committed Feb 13, 2013
1 parent 0f2b70c commit 60ca12c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,17 @@ abbreviations.

* Always use the new
["sexy" validations](http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/).
* When a custom validation is used more than once or the validation is some regular expression mapping,
create a custom validator file.

```Ruby
# bad
validates_presence_of :email
# good
validates :email, presence: true
```

* When a custom validation is used more than once or the validation is
some regular expression mapping, create a custom validator file.

```Ruby
# bad
Expand Down

0 comments on commit 60ca12c

Please sign in to comment.