SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 380 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

You may also provide a block
rather than a specific sequence name, and the result of the block will be the value Active Record
attempts to use as the sequence name.
Each database may handle sequences in its own way, so there is some variation in what is
required from Active Record??™s point of view. If you are using Oracle or Firebird, Active Record
assumes that sequences exist for each of your tables and are in the format of tablename_seq. If
you are using Firebird, Active Record will discover the proper sequence for you by default.
?– Note Because there is variation here on the Active Record assumptions, I recommend that you review
your specific adapter code just to be sure how sequences are handled.
CHAPTER 7 ?–  WORKING WITH LEGACY SCHEMA 172
In the following example, we assign an Oracle sequence called aid_seq to our Account
model:
# Setting sequence name with Oracle
require 'rubygems'
require_gem 'activerecord'
ActiveRecord::Base.establish_connection(:adapter => 'oci',
:host => 'test, :username => 'tester', :password => 'tester')
class Account < ActiveRecord::Base
set_sequence_name "aid_seq"
end
acc = Account.


Pages:
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6