In addition, several enterprising developers have made Active Record plug-ins that add
various levels of foreign key support to Active Record. Plug-ins providing foreign key support
essentially come in two flavors:
??? Augmenting your existing relationship ID columns with foreign keys
??? Actually establishing relationships based on foreign keys for you
If you are interested in using foreign keys with Active Record in either of these ways, there
are a few resources you should check out. RedHill Consulting, has made several plug-ins related
to foreign key support; you can find more about them at http://www.redhillonrails.org.
Additionally, for magic support for foreign keys (and much more) explore Dr. Nic??™s Magic
Models plug-in at http://magicmodels.rubyforge.org.
How Do I Properly Use find_by_sql?
The find_by_sql method simply accepts raw SQL, so you can essentially do any type of select
statement for which you can generate the SQL code.
?– Note We cover the find_by_sql method in detail in Chapter 7 as a part of our discussion on working
with legacy database systems.
Pages:
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478