aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-06-14 13:28:00 +0430
committerRizwan Reza <rizwanreza@gmail.com>2010-06-14 13:28:00 +0430
commit45230813177bc6aed417e657a26dd26d978d3746 (patch)
tree5633dd3990f8af71076b843b70acbfa802b76817
parentbf7429041e64ee0f347764a4579c8c1d14d5b391 (diff)
downloadrails-45230813177bc6aed417e657a26dd26d978d3746.tar.gz
rails-45230813177bc6aed417e657a26dd26d978d3746.tar.bz2
rails-45230813177bc6aed417e657a26dd26d978d3746.zip
Minor changes to callbacks and conversion API docs.
-rw-r--r--activemodel/lib/active_model/callbacks.rb12
-rw-r--r--activemodel/lib/active_model/conversion.rb18
2 files changed, 17 insertions, 13 deletions
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb
index ad12600d7c..f41a3e8ea5 100644
--- a/activemodel/lib/active_model/callbacks.rb
+++ b/activemodel/lib/active_model/callbacks.rb
@@ -41,7 +41,7 @@ module ActiveModel
# # Your code here
# end
#
- # You can choose not to have all three callbacks by passing an hash to the
+ # You can choose not to have all three callbacks by passing a hash to the
# define_model_callbacks method.
#
# define_model_callbacks :create, :only => :after, :before
@@ -55,13 +55,13 @@ module ActiveModel
end
end
- # define_model_callbacks accepts all options define_callbacks does, in case you
- # want to overwrite a default. Besides that, it also accepts an :only option,
+ # define_model_callbacks accepts the same options define_callbacks does, in case
+ # you want to overwrite a default. Besides that, it also accepts an :only option,
# where you can choose if you want all types (before, around or after) or just some.
#
# define_model_callbacks :initializer, :only => :after
#
- # Note, the <tt>:only => <type></tt> hash will apply to all callbacks defined on
+ # Note, the <tt>:only => <type></tt> hash will apply to all call backs defined on
# that method call. To get around this you can call the define_model_callbacks
# method as many times as you need.
#
@@ -73,7 +73,7 @@ module ActiveModel
#
# You can pass in a class to before_<type>, after_<type> and around_<type>, in which
# case the call back will call that class's <action>_<type> method passing the object
- # that the callback is being called on.
+ # that the call back is being called on.
#
# class MyModel
# extend ActiveModel::Callbacks
@@ -84,7 +84,7 @@ module ActiveModel
#
# class AnotherClass
# def self.before_create( obj )
- # # obj is the MyModel instance that the callback is being called on
+ # # obj is the MyModel instance that the call back is being called on
# end
# end
#
diff --git a/activemodel/lib/active_model/conversion.rb b/activemodel/lib/active_model/conversion.rb
index 23724b2d95..2a1650faa9 100644
--- a/activemodel/lib/active_model/conversion.rb
+++ b/activemodel/lib/active_model/conversion.rb
@@ -1,5 +1,7 @@
module ActiveModel
- # Handle default conversions: to_model, to_key and to_param.
+ # == Active Model Conversions
+ #
+ # Handles default conversions: to_model, to_key and to_param.
#
# == Example
#
@@ -20,17 +22,19 @@ module ActiveModel
# cm.to_param #=> nil
#
module Conversion
- # If your object is already designed to implement all of the Active Model you can use
- # the default to_model implementation, which simply returns self.
+ # If your object is already designed to implement all of the Active Model
+ # you can use the default to_model implementation, which simply returns
+ # self.
#
- # If your model does not act like an Active Model object, then you should define
- # <tt>:to_model</tt> yourself returning a proxy object that wraps your object
- # with Active Model compliant methods.
+ # If your model does not act like an Active Model object, then you should
+ # define <tt>:to_model</tt> yourself returning a proxy object that wraps
+ # your object with Active Model compliant methods.
def to_model
self
end
- # Returns an Enumerable of all (primary) key attributes or nil if persisted? is false
+ # Returns an Enumerable of all (primary) key attributes or nil if
+ # persisted? is false
def to_key
persisted? ? [id] : nil
end