module Naming
Ruby on Rails 6.0.6
Since v3.0.20Active 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.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.
Methods (defined here)
- # model_name
- self. param_key
- self. plural
- self. route_key
- self. singular
- self. singular_route_key
- self. uncountable?
Used by
Extendd by (6)
- ActionText::Attachables::MissingAttachable
- ActionText::Attachables::RemoteImage
- ActiveModel::Model
- ActiveModel::Serializers::JSON
- ActiveModel::Validations
- ActiveRecord::Base