-
Volmer Campos Soares authored
Instead of using the Active Record Base's class name, the table name is now inferred based on its model name object. This allows customization of the table name pattern since a distinct instance of `ActiveModel::Name` can be used instead. For example, to map a `PostRecord` class to a `posts` table: ```ruby class PostRecord < ActiveRecord::Base class << self def model_name ActiveModel::Name.new(self, nil, 'Post') end end end PostRecord.table_name # => "posts" ```
Volmer Campos Soares authoredInstead of using the Active Record Base's class name, the table name is now inferred based on its model name object. This allows customization of the table name pattern since a distinct instance of `ActiveModel::Name` can be used instead. For example, to map a `PostRecord` class to a `posts` table: ```ruby class PostRecord < ActiveRecord::Base class << self def model_name ActiveModel::Name.new(self, nil, 'Post') end end end PostRecord.table_name # => "posts" ```
Loading