We talk more about
Booleans and other data types in Chapter 7.
Active Record assigns values to all fields within a table. When you save a new Active Record
object or do an update on an Active Record object, Active Record actually assigns a value
to every field within the table in the database. If you haven??™t set a value for a given field,
the field will be set to nil. This is important to remember, because it means default values
set up within your database (like a timestamp) will most likely not be triggered since
a specific value is provided (nil) for the field. We covered this issue in Chapter 2 with create
and update statements and will speak about it again in Chapter 7, when we deal with
legacy database systems.
The items in this list are the key things you should keep in mind when designing your
database tables. You can ignore each as you see fit for your specific needs, but doing so generally
means more typing and more work for you as a developer. So, all things being equal, we
believe you??™re better off making your database conform to the way that Active Record is designed
to work.
Pages:
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139