Prev | Current Page 386 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"


Now that we have our models set up, we can finally start doing our CRUD operations.
CRUD Operations and Complex SQL Statements
We covered the basics of the various CRUD operations back in Chapter 2. And so long as you
use the various configuration options listed previously, you should be able to accomplish all
of the normal CRUD actions and take advantage of things like validations, callbacks, and
associations.
CHAPTER 7 ?–  WORKING WITH LEGACY SCHEMA 175
Still, there are many times when dealing with legacy systems that you may want to bypass
some of the advantages that Active Record gives you in exchange for better performance (obviously,
there is some processing overhead that goes into providing all those nice features). And
sometimes, it??™s easier to port your application from another language into Ruby by just using
the existing SQL statements, especially if you??™re comfortable with the SQL syntax your chosen
database supports. Depending on your background, you may find working with SQL joins a little
less confusing than dealing with model associations.


Pages:
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398