From 082ca51d65c988333c9afbda73cec857687bd4d9 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Sat, 24 Jul 2010 00:45:53 -0400 Subject: [PATCH] bringing consistency in comments --- activerecord/lib/active_record/reflection.rb | 31 +++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index a82e5d7ed1..09d7f8699e 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -50,7 +50,7 @@ module ActiveRecord # Returns an array of AssociationReflection objects for all the # associations in the class. If you only want to reflect on a certain # association type, pass in the symbol (:has_many, :has_one, - # :belongs_to) for that as the first parameter. + # :belongs_to) as the first parameter. # # Example: # @@ -62,9 +62,9 @@ module ActiveRecord macro ? association_reflections.select { |reflection| reflection.macro == macro } : association_reflections end - # Returns the AssociationReflection object for the named +association+ (use the symbol). Example: + # Returns the AssociationReflection object for the +association+ (use the symbol). # - # Account.reflect_on_association(:owner) # returns the owner AssociationReflection + # Account.reflect_on_association(:owner) # returns the owner AssociationReflection # Invoice.reflect_on_association(:line_items).macro # returns :has_many # def reflect_on_association(association) @@ -88,34 +88,37 @@ module ActiveRecord @macro, @name, @options, @active_record = macro, name, options, active_record end - # Returns the name of the macro. For example, composed_of :balance, - # :class_name => 'Money' will return :balance or for - # has_many :clients it will return :clients. + # Returns the name of the macro. + # composed_of :balance, :class_name => 'Money' will return :balance + # has_many :clients will return :clients def name @name end - # Returns the macro type. For example, + # Returns the macro type. # composed_of :balance, :class_name => 'Money' will return :composed_of - # or for has_many :clients will return :has_many. + # has_many :clients will return :has_many def macro @macro end - # Returns the hash of options used for the macro. For example, it would return { :class_name => "Money" } for - # composed_of :balance, :class_name => 'Money' or +{}+ for has_many :clients. + # Returns the hash of options used for the macro. + # composed_of :balance, :class_name => 'Money' will return { :class_name => "Money" } + # has_many :clients will return +{}+ def options @options end - # Returns the class for the macro. For example, composed_of :balance, :class_name => 'Money' returns the Money - # class and has_many :clients returns the Client class. + # Returns the class for the macro. + # composed_of :balance, :class_name => 'Money' will return the Money class + # has_many :clients will return the Client class def klass @klass ||= class_name.constantize end - # Returns the class name for the macro. For example, composed_of :balance, :class_name => 'Money' returns 'Money' - # and has_many :clients returns 'Client'. + # Returns the class name for the macro. + # composed_of :balance, :class_name => 'Money' will return 'Money' + # has_many :clients will return 'Client' def class_name @class_name ||= options[:class_name] || derive_class_name end