Skip to content
This repository
Browse code

Adds title and minor changes.

  • Loading branch information...
commit d8277804b2ad95275d21492f4d925d1148425253 1 parent 317a75b
Rizwan Reza authored June 16, 2010
2  activerecord/lib/active_record/migration.rb
@@ -29,7 +29,7 @@ def initialize(name)
29 29
     end
30 30
   end
31 31
 
32  
-  # Active Record Migrations
  32
+  # = Active Record Migrations
33 33
   # 
34 34
   # Migrations can manage the evolution of a schema used by several physical 
35 35
   # databases. It's a solution to the common problem of adding a field to make
11  activerecord/lib/active_record/named_scope.rb
@@ -4,11 +4,12 @@
4 4
 require 'active_support/core_ext/object/blank'
5 5
 
6 6
 module ActiveRecord
  7
+  # = Active Record Named Scopes
7 8
   module NamedScope
8 9
     extend ActiveSupport::Concern
9 10
 
10 11
     module ClassMethods
11  
-      # Returns an anonymous scope.
  12
+      # Returns an anonymous \scope.
12 13
       #
13 14
       #   posts = Post.scoped
14 15
       #   posts.size # Fires "select count(*) from  posts" and returns the count
@@ -18,10 +19,12 @@ module ClassMethods
18 19
       #   fruits = fruits.where(:colour => 'red') if options[:red_only]
19 20
       #   fruits = fruits.limit(10) if limited?
20 21
       #
21  
-      # Anonymous \scopes tend to be useful when procedurally generating complex queries, where passing
22  
-      # intermediate values (scopes) around as first-class objects is convenient.
  22
+      # Anonymous scopes tend to be useful when procedurally generating complex
  23
+      # queries, where passing intermediate values (scopes) around as first-class 
  24
+      # objects is convenient.
23 25
       #
24  
-      # You can define a scope that applies to all finders using ActiveRecord::Base.default_scope.
  26
+      # You can define a scope that applies to all finders using 
  27
+      # ActiveRecord::Base.default_scope.
25 28
       def scoped(options = {}, &block)
26 29
         if options.present?
27 30
           relation = scoped.apply_finder_options(options)
3  activerecord/lib/active_record/nested_attributes.rb
@@ -15,7 +15,7 @@ class TooManyRecords < ActiveRecordError
15 15
       self.nested_attributes_options = {}
16 16
     end
17 17
 
18  
-    # == Nested Attributes
  18
+    # = Active Record Nested Attributes
19 19
     #
20 20
     # Nested attributes allow you to save attributes on associated records
21 21
     # through the parent. By default nested attribute updating is turned off,
@@ -25,6 +25,7 @@ class TooManyRecords < ActiveRecordError
25 25
     #
26 26
     # The attribute writer is named after the association, which means that
27 27
     # in the following example, two new methods are added to your model:
  28
+    # 
28 29
     # <tt>author_attributes=(attributes)</tt> and
29 30
     # <tt>pages_attributes=(attributes)</tt>.
30 31
     #
2  activerecord/lib/active_record/observer.rb
... ...
@@ -1,6 +1,8 @@
1 1
 require 'active_support/core_ext/class/attribute'
2 2
 
3 3
 module ActiveRecord
  4
+  # = Active Record Observer
  5
+  #
4 6
   # Observer classes respond to lifecycle callbacks to implement trigger-like
5 7
   # behavior outside the original class. This is a great way to reduce the
6 8
   # clutter that normally comes when the model class is burdened with
29  activerecord/lib/active_record/persistence.rb
... ...
@@ -1,6 +1,8 @@
1 1
 module ActiveRecord
  2
+  # = Active Record Persistence
2 3
   module Persistence
3  
-    # Returns true if this object hasn't been saved yet -- that is, a record for the object doesn't exist yet; otherwise, returns false.
  4
+    # Returns true if this object hasn't been saved yet -- that is, a record 
  5
+    # for the object doesn't exist in the data store yet; otherwise, returns false.
4 6
     def new_record?
5 7
       @new_record
6 8
     end
@@ -10,7 +12,8 @@ def destroyed?
10 12
       @destroyed
11 13
     end
12 14
 
13  
-    # Returns if the record is persisted, i.e. it's not a new record and it was not destroyed.
  15
+    # Returns if the record is persisted, i.e. it's not a new record and it was
  16
+    # not destroyed.
14 17
     def persisted?
15 18
       !(new_record? || destroyed?)
16 19
     end
@@ -69,8 +72,8 @@ def delete
69 72
       freeze
70 73
     end
71 74
 
72  
-    # Deletes the record in the database and freezes this instance to reflect that no changes should
73  
-    # be made (since they can't be persisted).
  75
+    # Deletes the record in the database and freezes this instance to reflect 
  76
+    # that no changes should be made (since they can't be persisted).
74 77
     def destroy
75 78
       if persisted?
76 79
         self.class.unscoped.where(self.class.arel_table[self.class.primary_key].eq(id)).delete_all
@@ -80,10 +83,13 @@ def destroy
80 83
       freeze
81 84
     end
82 85
 
83  
-    # Returns an instance of the specified +klass+ with the attributes of the current record. This is mostly useful in relation to
84  
-    # single-table inheritance structures where you want a subclass to appear as the superclass. This can be used along with record
85  
-    # identification in Action Pack to allow, say, <tt>Client < Company</tt> to do something like render <tt>:partial => @client.becomes(Company)</tt>
86  
-    # to render that instance using the companies/company partial instead of clients/client.
  86
+    # Returns an instance of the specified +klass+ with the attributes of the 
  87
+    # current record. This is mostly useful in relation to single-table 
  88
+    # inheritance structures where you want a subclass to appear as the 
  89
+    # superclass. This can be used along with record identification in 
  90
+    # Action Pack to allow, say, <tt>Client < Company</tt> to do something 
  91
+    # like render <tt>:partial => @client.becomes(Company)</tt> to render that
  92
+    # instance using the companies/company partial instead of clients/client.
87 93
     #
88 94
     # Note: The new instance will share a link to the same attributes as the original class. So any change to the attributes in either
89 95
     # instance will affect the other.
@@ -104,14 +110,15 @@ def update_attribute(name, value)
104 110
       save(:validate => false)
105 111
     end
106 112
 
107  
-    # Updates all the attributes from the passed-in Hash and saves the record. If the object is invalid, the saving will
108  
-    # fail and false will be returned.
  113
+    # Updates all the attributes from the passed-in Hash and saves the record. 
  114
+    # If the object is invalid, the saving will fail and false will be returned.
109 115
     def update_attributes(attributes)
110 116
       self.attributes = attributes
111 117
       save
112 118
     end
113 119
 
114  
-    # Updates an object just like Base.update_attributes but calls save! instead of save so an exception is raised if the record is invalid.
  120
+    # Updates an object just like Base.update_attributes but calls save! instead
  121
+    # of save so an exception is raised if the record is invalid.
115 122
     def update_attributes!(attributes)
116 123
       self.attributes = attributes
117 124
       save!

0 notes on commit d827780

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