Still, there are times when sticking to just one realm may cause you more trouble than it??™s
worth. For example, many of us have already spent a large amount of our time and energy
learning the details of various SQL syntax and database management systems. So sometimes,
CHAPTER 7 ?– WORKING WITH LEGACY SCHEMA 163
it??™s just easier for us to write a quick SQL statement than to define all of our models, specify
our associations, and then write the proper finder method.
It really depends on what your current needs are and how long you are going to need to
support your scripts (we often just use find_by_sql with raw SQL statements for ad hoc stuff
but go the proper Active Record route for scripts that are going to exist longer). Only you know
what you??™re really good at, and only you know what realm really makes the best sense for spending
the majority of your time. So in the end, it??™s really about what??™s most efficient for you.
Configuration Options for Active Record
You??™ve decided that the trade-offs are worth it, and you want to go ahead and use Active Record
with your legacy schema, moving most of your work into the Active Record realm.
Pages:
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373