The following example changes the column used for the Account class from the
default of "type" to "object_type":
class Account < ActiveRecord::Base
def set_inheritance_column
"object_type"
end
end
set_locking_column(value = nil, &block)
Active Record supports optimistic locking if the database column lock_version is present. For
more information about the optimistic locking features of Active Record, see Chapter 2. You
can override the name of the expected database column from lock_version to something different
with this method, for example:
class Account < ActiveRecord::Base
set_locking_column "locking_column"
end
set_primary_key(value = nil, &block)
Set the name of the database column that holds the primary key as follows:
class Account < ActiveRecord::Base
set_primary_key "accountid"
end
set_sequence_name(value = nil, &block)
Set the name of the sequence to use for the generation of primary keys with this method; use
it with Oracle or other databases that use sequences for primary key generation.
If the sequence name is not specifically set when using an Oracle or Firebird database, the
common sequence name of #{table_name}_seq will be used.
Pages:
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499