This isn??™t to say that you can??™t use multiple approaches together, and
in fact, it??™s often a good idea to use some level of validations in your controllers and
JavaScript to make a better environment for your users and to double-check that those
validations are properly enforced within your models.
??? You can use database constraints, triggers, and stored procedures. As a Ruby developer,
this option probably doesn??™t appeal to you, because it means taking the control out of
your hands and giving it to your DBA (if you??™re also the DBA, at a minimum, it still means
taking off your Ruby hat and putting on your DBA hat). The other big downside to this
approach is that your validations would be database- and schema-specific, which makes
migrations or switching to another database backend more difficult down the road. Still,
if you??™ve got more than one application accessing your database, especially if they aren??™t
all using Active Record to do so, you??™ll probably want to move??”or at least duplicate??”
your critical validations directly inside of the database.
Pages:
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213