Type:
Module

Active Model Naming

Creates a model_name method on your object.

To implement, just extend ActiveModel::Naming in your object:

class BookCover
  extend ActiveModel::Naming
end

BookCover.model_name        # => "BookCover"
BookCover.model_name.human  # => "Book cover"

BookCover.model_name.i18n_key              # => :book_cover
BookModule::BookCover.model_name.i18n_key  # => :"book_module/book_cover"

Providing the functionality that ActiveModel::Naming provides in your object is required to pass the Active Model Lint test. So either extending the provided method below, or rolling your own is required.

param_key

param_key(record_or_class) Class Public methods Returns string to use for params

2015-06-20 00:00:00
route_key

route_key(record_or_class) Class Public methods Returns string to use while

2015-06-20 00:00:00
uncountable?

uncountable?(record_or_class) Class Public methods Identifies whether the class

2015-06-20 00:00:00
singular_route_key

singular_route_key(record_or_class) Class Public methods Returns string to use

2015-06-20 00:00:00
model_name

model_name() Instance Public methods Returns an

2015-06-20 00:00:00
singular

singular(record_or_class) Class Public methods Returns the singular class name

2015-06-20 00:00:00
plural

plural(record_or_class) Class Public methods Returns the plural class name of

2015-06-20 00:00:00