Data is more important than code, therefore the most important job you, as a programmer, have is to design a system that allows for a simple, constrained, and predictable set of data. In this episode, I'll discuss how null constraints can reduce the number of types your program has to deal with, thereby simplifying your code. Then I discuss how
check constraints can force data to take a limited (and more useful) range of values. Lastly I'll explain why it's better to carry all this out at the database level rather than at the Ruby/Python/Php/JS level.
Postgresql Documentation on Constraints - covers check constraints, not null constraints, and more. Are email addresses case sensitive - technically the part before the "@" in an email can be case sensitive, but in practice it almost never is. The &. operator you saw - Ruby's safe navigation operator (&.)
Attribute Normalizer gem - what I use at the Rails level to remove trailing/leading whitespaces before saving records Lifecyle methods - how Rails allows you to hook in behavior when a record is created, saved, etc.
Our screencasts are aimed at intermediate and advanced programmers and focus on:
Mailing list members receive exclusive content as well as episode alerts. Never spam.