Prev | Current Page 358 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

And
CHAPTER 7 ?–  WORKING WITH LEGACY SCHEMA 162
how many data scrubbing procedures do you want to write to ensure the data you read in is
really as clean as you need it to be when those Java programs continue to let in new variations
on bad data? In that sort of situation, it??™s clear that the database itself should be the gatekeeper,
allowing in and sending out only good data.
So, the decision comes down to you, as an Active Record programmer; how much should
you deal with directly in your Active Record program, and how much should your database
directly handle? In the end, it??™s a personal decision that each developer will need to make.
However, our advice to you is to move central issues, such as data validations, into your database
tier but leave custom details, like figuring out the proper tax for your application via
a callback, directly in your code.
This way, you maintain as much control (and simplicity) as possible while at the same
time only spending time and effort outside of your realm when it really makes sense to do so.


Pages:
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370