Now, what
do you do? How do you get everything to actually work?
As it turns out, the real key to using Active Record with a legacy schema is primarily in the
configuration work that you have to do. That is, you have to tell Active Record which of its
default assumptions it should not make for your schema, or put another way, what assumptions
your schema doesn??™t adhere to.
It sounds like things could get messy, but it??™s not so bad. In fact, most database libraries
available today do not come with any assumptions built in and instead, require you, the developer,
to define all the details of how to interpret your schema for each of your programs. Many
times, they ask you to abstract those details into an external XML configuration file.
In our case, though, we don??™t have to spend hours writing XML configuration files. We can
just specify most of our configuration options as simple assignments directly in our applications,
which many of our examples throughout this chapter will outline.
Best of all, after you work through the various options listed as follows, you??™ll probably
find your designs are not that far off from the design decisions Active Record assumes, which
often means that you only need to make a few small configuration settings to get your legacy
schema realizing the full power of Active Record!
Remember that one of the primary design goals of Active Record is to cut down on configurations
required to get our programs to work.
Pages:
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374