Prev | Current Page 381 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

new # => this should trigger the execution of the sequence aid_seq
acc.username = 'Kevin'
acc.save
puts acc.id #=> this should display the value of the sequence we executed.
Making the Complex Easier
We??™ve got the basic configuration concepts under control, and we think we can at least get
Active Record talking to our database in a fairly standard Active Record way using those options.
Now, it??™s time to shift our focus a little bit from setting things up to actually dealing with the
more complex issue of working with the things we??™ve set up.
To do that, we need to have an example we can work with. The first thing we should probably
do is to define some tables for our legacy schema to use in the examples throughout the
rest of this chapter, so we are all on the same page as we work through various issues.
To start, let??™s pretend that we are going to be writing some Active Record scripts to work
with a legacy schema that also has some historical Java applications accessing it. Because the
Java applications are distributed to a number of clients (which are not entirely under our control
anymore), and we want those Java programs to continue to work, we cannot remove any
existing tables or change the existing column names in our database.


Pages:
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393