module Believer::ModelSchema

Mostly borrowed from ActiveRecord::ModelSchema ;)

Public Class Methods

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/believer/model_schema.rb, line 33
class_attribute :pluralize_table_names, :instance_writer => false
table_name_prefix() click to toggle source

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.

# File lib/believer/model_schema.rb, line 18
class_attribute :table_name_prefix, :instance_writer => false
table_name_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.

# File lib/believer/model_schema.rb, line 25
class_attribute :table_name_suffix, :instance_writer => false