# module ActiveRecord::ModelSchema

### Public Class Methods

ignored_columns click to toggle source

The list of columns names the model should ignore. Ignored columns won't have attribute accessors defined, and won't be referenced in SQL queries.

    # File lib/active_record/model_schema.rb, line 123

ignored_columns=(columns) click to toggle source

Sets the columns names the model should ignore. Ignored columns won't have attribute accessors defined, and won't be referenced in SQL queries.

    # File lib/active_record/model_schema.rb, line 130
    included do
      mattr_accessor :primary_key_prefix_type, instance_writer: false

      class_attribute :table_name_prefix, instance_writer: false
      self.table_name_prefix = ""

      class_attribute :table_name_suffix, instance_writer: false
      self.table_name_suffix = ""

      class_attribute :schema_migrations_table_name, instance_accessor: false
      self.schema_migrations_table_name = "schema_migrations"

      class_attribute :internal_metadata_table_name, instance_accessor: false
      self.internal_metadata_table_name = "ar_internal_metadata"

      class_attribute :protected_environments, instance_accessor: false
      self.protected_environments = ["production"]

      class_attribute :pluralize_table_names, instance_writer: false
      self.pluralize_table_names = true

      class_attribute :ignored_columns, instance_accessor: false
      self.ignored_columns = [].freeze

      self.inheritance_column = "type"

      delegate :type_for_attribute, to: :class

      initialize_load_schema_monitor
    end

internal_metadata_table_name click to toggle source

The name of the internal metadata table. By default, the value is `"ar_internal_metadata"`.

    # File lib/active_record/model_schema.rb, line 81

internal_metadata_table_name=(table_name) click to toggle source

Sets the name of the internal metadata table.

    # File lib/active_record/model_schema.rb, line 87

pluralize_table_names click to toggle source

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.

    # File lib/active_record/model_schema.rb, line 108

pluralize_table_names=(value) click to toggle source

Set 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.

    # File lib/active_record/model_schema.rb, line 116

primary_key_prefix_type click to toggle source

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.

    # File lib/active_record/model_schema.rb, line 17

primary_key_prefix_type=(prefix_type) click to toggle source

Sets 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.

    # File lib/active_record/model_schema.rb, line 27

protected_environments click to toggle source

The array of names of environments where destructive actions should be prohibited. By default, the value is `["production"]`.

    # File lib/active_record/model_schema.rb, line 94

protected_environments=(environments) click to toggle source

Sets an array of names of environments where destructive actions should be prohibited.

    # File lib/active_record/model_schema.rb, line 100

schema_migrations_table_name click to toggle source

The name of the schema migrations table. By default, the value is `"schema_migrations"`.

    # File lib/active_record/model_schema.rb, line 69

schema_migrations_table_name=(table_name) click to toggle source

Sets the name of the schema migrations table.

    # File lib/active_record/model_schema.rb, line 75

table_name_prefix click to toggle source

The prefix string to prepend to every table name.

    # File lib/active_record/model_schema.rb, line 33

table_name_prefix=(prefix) click to toggle source

Sets 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.

    # File lib/active_record/model_schema.rb, line 46

table_name_suffix click to toggle source

The suffix string to append to every table name.

    # File lib/active_record/model_schema.rb, line 52

table_name_suffix=(suffix) click to toggle source

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.

    # File lib/active_record/model_schema.rb, line 63