aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-06-23 16:58:36 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-06-23 16:58:36 -0500
commit87615f28e0b80cdf2166fd32dde1a7e544e05c01 (patch)
tree81346a8c22873dcbff564b73e7cc72ff0992f18b
parent956c8e569a3b1fa6f10d7296d6bdb82f3f250e29 (diff)
downloadrails-87615f28e0b80cdf2166fd32dde1a7e544e05c01.tar.gz
rails-87615f28e0b80cdf2166fd32dde1a7e544e05c01.tar.bz2
rails-87615f28e0b80cdf2166fd32dde1a7e544e05c01.zip
update ActiveModel::Naming documentation
-rw-r--r--activemodel/lib/active_model/naming.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index 2b5fc57a3a..9326c2aebf 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -82,11 +82,12 @@ module ActiveModel
# 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.
+ # is required to pass the Active Model 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.
+ # used to retrieve all kinds of naming-related information
+ # (See ActiveModel::Name for more information).
def model_name
@_model_name ||= begin
namespace = self.parents.detect do |n|
@@ -96,7 +97,7 @@ module ActiveModel
end
end
- # Returns the plural class name of a record or class. Examples:
+ # Returns the plural class name of a record or class.
#
# ActiveModel::Naming.plural(post) # => "posts"
# ActiveModel::Naming.plural(Highrise::Person) # => "highrise_people"
@@ -104,7 +105,7 @@ module ActiveModel
model_name_from_record_or_class(record_or_class).plural
end
- # Returns the singular class name of a record or class. Examples:
+ # Returns the singular class name of a record or class.
#
# ActiveModel::Naming.singular(post) # => "post"
# ActiveModel::Naming.singular(Highrise::Person) # => "highrise_person"
@@ -112,10 +113,10 @@ module ActiveModel
model_name_from_record_or_class(record_or_class).singular
end
- # Identifies whether the class name of a record or class is uncountable. Examples:
+ # Identifies whether the class name of a record or class is uncountable.
#
# ActiveModel::Naming.uncountable?(Sheep) # => true
- # ActiveModel::Naming.uncountable?(Post) => false
+ # ActiveModel::Naming.uncountable?(Post) # => false
def self.uncountable?(record_or_class)
plural(record_or_class) == singular(record_or_class)
end