aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/naming.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/naming.rb')
-rw-r--r--activemodel/lib/active_model/naming.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index 4cd68a0c89..89e8f8b1ea 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -35,6 +35,21 @@ module ActiveModel
end
end
+ # ActiveModel::Naming is a module that creates a +model_name+ method on your
+ # object.
+ #
+ # To implement, just extend ActiveModel::Naming in your object:
+ #
+ # class BookCover
+ # exten ActiveModel::Naming
+ # end
+ #
+ # BookCover.model_name #=> "BookCover"
+ # BookCover.model_name.human #=> "Book cover"
+ #
+ # Providing the functionality that ActiveModel::Naming provides in your object
+ # is required to pass the ActiveModel Lint test. So either extending the provided
+ # method below, or rolling your own is required..
module Naming
# Returns an ActiveModel::Name object for module. It can be
# used to retrieve all kinds of naming-related information.