Skip to content
This repository
Browse code

Adds basic description and title.

  • Loading branch information...
commit 2b7f08428c5e2a866f65ab0ba2838da5857c471b 1 parent d827780
Rizwan Reza authored June 16, 2010
1  activerecord/lib/active_record/query_cache.rb
... ...
@@ -1,6 +1,7 @@
1 1
 require 'active_support/core_ext/object/blank'
2 2
 
3 3
 module ActiveRecord
  4
+  # = Active Record Query Cache
4 5
   class QueryCache
5 6
     module ClassMethods
6 7
       # Enable the query cache within the block if Active Record is configured.
1  activerecord/lib/active_record/railtie.rb
@@ -9,6 +9,7 @@
9 9
 require "action_controller/railtie"
10 10
 
11 11
 module ActiveRecord
  12
+  # = Active Record Railtie
12 13
   class Railtie < Rails::Railtie
13 14
     config.active_record = ActiveSupport::OrderedOptions.new
14 15
 
45  activerecord/lib/active_record/reflection.rb
... ...
@@ -1,12 +1,16 @@
1 1
 module ActiveRecord
  2
+  # = Active Record Reflection
2 3
   module Reflection # :nodoc:
3 4
     extend ActiveSupport::Concern
4 5
 
5  
-    # Reflection allows you to interrogate Active Record classes and objects about their associations and aggregations.
6  
-    # This information can, for example, be used in a form builder that took an Active Record object and created input
7  
-    # fields for all of the attributes depending on their type and displayed the associations to other objects.
  6
+    # Reflection allows you to interrogate Active Record classes and objects
  7
+    # about their associations and aggregations. This information can, 
  8
+    # for example, be used in a form builder that took an Active Record object
  9
+    # and created input fields for all of the attributes depending on their type
  10
+    # and displayed the associations to other objects.
8 11
     #
9  
-    # You can find the interface for the AggregateReflection and AssociationReflection classes in the abstract MacroReflection class.
  12
+    # You can find the interface for the AggregateReflection and AssociationReflection
  13
+    # classes in the abstract MacroReflection class.
10 14
     module ClassMethods
11 15
       def create_reflection(macro, name, options, active_record)
12 16
         case macro
@@ -43,8 +47,11 @@ def reflect_on_aggregation(aggregation)
43 47
         reflections[aggregation].is_a?(AggregateReflection) ? reflections[aggregation] : nil
44 48
       end
45 49
 
46  
-      # Returns an array of AssociationReflection objects for all the associations in the class. If you only want to reflect on a
47  
-      # certain association type, pass in the symbol (<tt>:has_many</tt>, <tt>:has_one</tt>, <tt>:belongs_to</tt>) for that as the first parameter.
  50
+      # Returns an array of AssociationReflection objects for all the 
  51
+      # associations in the class. If you only want to reflect on a certain 
  52
+      # association type, pass in the symbol (<tt>:has_many</tt>, <tt>:has_one</tt>, 
  53
+      # <tt>:belongs_to</tt>) for that as the first parameter.
  54
+      #
48 55
       # Example:
49 56
       #
50 57
       #   Account.reflect_on_all_associations             # returns an array of all associations
@@ -71,8 +78,9 @@ def reflect_on_all_autosave_associations
71 78
     end
72 79
 
73 80
 
74  
-    # Abstract base class for AggregateReflection and AssociationReflection that describes the interface available for both of
75  
-    # those classes. Objects of AggregateReflection and AssociationReflection are returned by the Reflection::ClassMethods.
  81
+    # Abstract base class for AggregateReflection and AssociationReflection that
  82
+    # describes the interface available for both of those classes. Objects of
  83
+    # AggregateReflection and AssociationReflection are returned by the Reflection::ClassMethods.
76 84
     class MacroReflection
77 85
       attr_reader :active_record
78 86
 
@@ -80,13 +88,15 @@ def initialize(macro, name, options, active_record)
80 88
         @macro, @name, @options, @active_record = macro, name, options, active_record
81 89
       end
82 90
 
83  
-      # Returns the name of the macro.  For example, <tt>composed_of :balance, :class_name => 'Money'</tt> will return
84  
-      # <tt>:balance</tt> or for <tt>has_many :clients</tt> it will return <tt>:clients</tt>.
  91
+      # Returns the name of the macro.  For example, <tt>composed_of :balance, 
  92
+      # :class_name => 'Money'</tt> will return <tt>:balance</tt> or for 
  93
+      # <tt>has_many :clients</tt> it will return <tt>:clients</tt>.
85 94
       def name
86 95
         @name
87 96
       end
88 97
 
89  
-      # Returns the macro type. For example, <tt>composed_of :balance, :class_name => 'Money'</tt> will return <tt>:composed_of</tt>
  98
+      # Returns the macro type. For example, 
  99
+      # <tt>composed_of :balance, :class_name => 'Money'</tt> will return <tt>:composed_of</tt>
90 100
       # or for <tt>has_many :clients</tt> will return <tt>:has_many</tt>.
91 101
       def macro
92 102
         @macro
@@ -132,11 +142,13 @@ def derive_class_name
132 142
     end
133 143
 
134 144
 
135  
-    # Holds all the meta-data about an aggregation as it was specified in the Active Record class.
  145
+    # Holds all the meta-data about an aggregation as it was specified in the 
  146
+    # Active Record class.
136 147
     class AggregateReflection < MacroReflection #:nodoc:
137 148
     end
138 149
 
139  
-    # Holds all the meta-data about an association as it was specified in the Active Record class.
  150
+    # Holds all the meta-data about an association as it was specified in the 
  151
+    # Active Record class.
140 152
     class AssociationReflection < MacroReflection #:nodoc:
141 153
       # Returns the target association's class:
142 154
       #
@@ -306,9 +318,12 @@ def derive_primary_key_name
306 318
         end
307 319
     end
308 320
 
309  
-    # Holds all the meta-data about a :through association as it was specified in the Active Record class.
  321
+    # Holds all the meta-data about a :through association as it was specified
  322
+    # in the Active Record class.
310 323
     class ThroughReflection < AssociationReflection #:nodoc:
311  
-      # Gets the source of the through reflection.  It checks both a singularized and pluralized form for <tt>:belongs_to</tt> or <tt>:has_many</tt>.
  324
+      # Gets the source of the through reflection.  It checks both a singularized
  325
+      # and pluralized form for <tt>:belongs_to</tt> or <tt>:has_many</tt>.
  326
+      #
312 327
       # (The <tt>:tags</tt> association on Tagging below.)
313 328
       #
314 329
       #   class Post < ActiveRecord::Base
8  activerecord/lib/active_record/relation.rb
... ...
@@ -1,6 +1,7 @@
1 1
 require 'active_support/core_ext/object/blank'
2 2
 
3 3
 module ActiveRecord
  4
+  # = Active Record Relation
4 5
   class Relation
5 6
     JoinOperation = Struct.new(:relation, :join_class, :on)
6 7
     ASSOCIATION_METHODS = [:includes, :eager_load, :preload]
@@ -75,10 +76,12 @@ def to_a
75 76
       @records
76 77
     end
77 78
 
  79
+    # Returns size of the records.
78 80
     def size
79 81
       loaded? ? @records.length : count
80 82
     end
81 83
 
  84
+    # Returns true if there are no records.
82 85
     def empty?
83 86
       loaded? ? @records.empty? : count.zero?
84 87
     end
@@ -240,8 +243,9 @@ def destroy(id)
240 243
     #   Post.delete_all("person_id = 5 AND (category = 'Something' OR category = 'Else')")
241 244
     #   Post.delete_all(["person_id = ? AND (category = ? OR category = ?)", 5, 'Something', 'Else'])
242 245
     #
243  
-    # Both calls delete the affected posts all at once with a single DELETE statement. If you need to destroy dependent
244  
-    # associations or call your <tt>before_*</tt> or +after_destroy+ callbacks, use the +destroy_all+ method instead.
  246
+    # Both calls delete the affected posts all at once with a single DELETE statement. 
  247
+    # If you need to destroy dependent associations or call your <tt>before_*</tt> or 
  248
+    # +after_destroy+ callbacks, use the +destroy_all+ method instead.
245 249
     def delete_all(conditions = nil)
246 250
       conditions ? where(conditions).delete_all : arel.delete.tap { reset }
247 251
     end

0 notes on commit 2b7f084

Please sign in to comment.
Something went wrong with that request. Please try again.