123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::ModelSchema

Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: activerecord/lib/active_record/model_schema.rb

Class Method Summary

DSL Calls

included

[ GitHub ]


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'activerecord/lib/active_record/model_schema.rb', line 5

included do
  ##
  # :singleton-method:
  # Accessor for the prefix type that will be prepended to every primary key column name.
  # The options are :table_name and :table_name_with_underscore. If the first is specified,
  # the Product class will look for "productid" instead of "id" as the primary column. If the
  # latter is specified, the Product class will look for "product_id" instead of "id". Remember
  # that this is a global setting for all Active Records.
  mattr_accessor :primary_key_prefix_type, instance_writer: false

  ##
  # :singleton-method:
  # Accessor for the name of the prefix string to prepend to every table name. So if set
  # to "basecamp_", all table names will be named like "basecamp_projects", "basecamp_people",
  # etc. This is a convenient way of creating a namespace for tables in a shared database.
  # By default, the prefix is the empty string.
  #
  # If you are organising your models within modules you can add a prefix to the models within
  # a namespace by defining a singleton method in the parent module called table_name_prefix which
  # returns your chosen prefix.
  class_attribute :table_name_prefix, instance_writer: false
  self.table_name_prefix = ""

  ##
  # :singleton-method:
  # Works like table_name_prefix, but appends instead of prepends (set to "_basecamp" gives "projects_basecamp",
  # "people_basecamp"). By default, the suffix is the empty string.
  #
  # If you are organising your models within modules, you can add a suffix to the models within
  # a namespace by defining a singleton method in the parent module called table_name_suffix which
  # returns your chosen suffix.
  class_attribute :table_name_suffix, instance_writer: false
  self.table_name_suffix = ""

  ##
  # :singleton-method:
  # Accessor for the name of the schema migrations table. By default, the value is "schema_migrations"
  class_attribute :schema_migrations_table_name, instance_accessor: false
  self.schema_migrations_table_name = "schema_migrations"

  ##
  # :singleton-method:
  # Indicates whether table names should be the pluralized versions of the corresponding class names.
  # If true, the default table name for a Product class will be products. If false, it would just be product.
  # See table_name for the full rules on table/class naming. This is true, by default.
  class_attribute :pluralize_table_names, instance_writer: false
  self.pluralize_table_names = true

  self.inheritance_column = 'type'

  delegate :type_for_attribute, to: :class
end