aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-01-18 18:13:49 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-01-18 18:13:49 +1100
commit91c38403be88a2a9a3485ddd58237445fa176a77 (patch)
tree1a89bf8a1daa37c84ff64a1ff31ccd599a095487 /activemodel/lib
parent71328a9856734dda82620f42e5161c7a74696145 (diff)
downloadrails-91c38403be88a2a9a3485ddd58237445fa176a77.tar.gz
rails-91c38403be88a2a9a3485ddd58237445fa176a77.tar.bz2
rails-91c38403be88a2a9a3485ddd58237445fa176a77.zip
Adding documentation for ActiveModel::Translation
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/translation.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb
index 2d2df269d0..2ab342ffac 100644
--- a/activemodel/lib/active_model/translation.rb
+++ b/activemodel/lib/active_model/translation.rb
@@ -1,6 +1,23 @@
require 'active_support/core_ext/hash/reverse_merge'
module ActiveModel
+
+ # ActiveModel::Translation provides integration between your object and
+ # the Rails internationalization (i18n) framework.
+ #
+ # A minimal implementation could be:
+ #
+ # class TranslatedPerson
+ # extend ActiveModel::Translation
+ # end
+ #
+ # TranslatedPerson.human_attribute_name('my_attribue')
+ # #=> "My attribute"
+ #
+ # This also provides the required class methods for hooking into the
+ # Rails internationalization API, including being able to define a
+ # class based i18n_scope and lookup_ancestors to find translations in
+ # parent classes.
module Translation
include ActiveModel::Naming
@@ -18,8 +35,6 @@ module ActiveModel
# Transforms attributes names into a more human format, such as "First name" instead of "first_name".
#
- # Example:
- #
# Person.human_attribute_name("first_name") # => "First name"
#
# Specify +options+ with additional translating options.