Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8113

Show
Ignore:
Timestamp:
11/08/07 03:37:16 (1 year ago)
Author:
marcel
Message:

Smattering of grammatical fixes to documentation. Closes #10083 [BobSilva]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r8107 r8113  
    11*SVN* 
     2 
     3* Smattering of grammatical fixes to documentation. Closes #10083 [BobSilva] 
    24 
    35* Enhance explanation with more examples for attr_accessible macro. Closes #8095 [fearoffish, Marcel Molina] 
  • trunk/activerecord/lib/active_record/associations.rb

    r8109 r8113  
    244244    # == Unsaved objects and associations 
    245245    # 
    246     # You can manipulate objects and associations before they are saved to the database, but there is some special behaviour you should be 
     246    # You can manipulate objects and associations before they are saved to the database, but there is some special behavior you should be 
    247247    # aware of, mostly involving the saving of associated objects. 
    248248    # 
     
    268268    # 
    269269    # Similiar to the normal callbacks that hook into the lifecycle of an Active Record object, you can also define callbacks that get 
    270     # trigged when you add an object to or remove an object from an association collection. Example: 
     270    # triggered when you add an object to or remove an object from an association collection. Example: 
    271271    # 
    272272    #   class Project 
     
    585585      # * <tt>collection=objects</tt> - replaces the collections content by deleting and adding objects as appropriate. 
    586586      # * <tt>collection_singular_ids</tt> - returns an array of the associated objects' ids 
    587       # * <tt>collection_singular_ids=ids</tt> - replace the collection by the objects identified by the primary keys in +ids+ 
     587      # * <tt>collection_singular_ids=ids</tt> - replace the collection with the objects identified by the primary keys in +ids+ 
    588588      # * <tt>collection.clear</tt> - removes every object from the collection. This destroys the associated objects if they 
    589589      #   are associated with <tt>:dependent => :destroy</tt>, deletes them directly from the database if <tt>:dependent => :delete_all</tt>, 
    590       #   or otherwise sets their foreign keys to NULL. 
     590      #   otherwise sets their foreign keys to NULL. 
    591591      # * <tt>collection.empty?</tt> - returns +true+ if there are no associated objects. 
    592592      # * <tt>collection.size</tt> - returns the number of associated objects. 
     
    622622      # * <tt>:order</tt>       - specify the order in which the associated objects are returned as an <tt>ORDER BY</tt> SQL fragment, 
    623623      #   such as <tt>last_name, first_name DESC</tt> 
    624       # * <tt>:group</tt>       - specify the attribute by which the associated objects are returned as a <tt>GROUP BY</tt> SQL fragment, 
    625       #   such as +category+ 
    626624      # * <tt>:foreign_key</tt> - specify the foreign key used for the association. By default this is guessed to be the name 
    627625      #   of this class in lower-case and +_id+ suffixed. So a +Person+ class that makes a +has_many+ association will use +person_id+ 
     
    634632      #   associations that depend on multiple tables. Note: When this option is used, +find_in_collection+ is _not_ added. 
    635633      # * <tt>:counter_sql</tt>  - specify a complete SQL statement to fetch the size of the association. If <tt>:finder_sql</tt> is 
    636       #   specified but <tt>:counter_sql</tt>, <tt>:counter_sql</tt> will be generated by replacing <tt>SELECT ... FROM</tt> with <tt>SELECT COUNT(*) FROM</tt>. 
     634      #   specified but not <tt>:counter_sql</tt>, <tt>:counter_sql</tt> will be generated by replacing <tt>SELECT ... FROM</tt> with <tt>SELECT COUNT(*) FROM</tt>. 
    637635      # * <tt>:extend</tt>  - specify a named module for extending the proxy. See "Association extensions". 
    638636      # * <tt>:include</tt>  - specify second-order associations that should be eager loaded when the collection is loaded. 
     
    640638      # * <tt>:limit</tt>: An integer determining the limit on the number of rows that should be returned. 
    641639      # * <tt>:offset</tt>: An integer determining the offset from where the rows should be fetched. So at 5, it would skip the first 4 rows. 
    642       # * <tt>:select</tt>: By default, this is <tt>*</tt> as in <tt>SELECT * FROM</tt>, but can be changed if you for example want to do a join,  
     640      # * <tt>:select</tt>: By default, this is <tt>*</tt> as in <tt>SELECT * FROM</tt>, but can be changed if you, for example, want to do a join  
    643641      #   but not include the joined columns. 
    644642      # * <tt>:as</tt>: Specifies a polymorphic interface (See <tt>#belongs_to</tt>). 
     
    709707      # * <tt>:conditions</tt>  - specify the conditions that the associated object must meet in order to be included as a +WHERE+ 
    710708      #   SQL fragment, such as <tt>rank = 5</tt>. 
    711       # * <tt>:order</tt>       - specify the order from which the associated object will be picked at the top. Specified as 
    712       #   an <tt>ORDER BY</tt> SQL fragment, such as <tt>last_name, first_name DESC</tt> 
     709      # * <tt>:order</tt>       - specify the order in which the associated objects are returned as an <tt>ORDER BY</tt> SQL fragment, 
     710      #   such as <tt>last_name, first_name DESC</tt> 
    713711      # * <tt>:dependent</tt>   - if set to <tt>:destroy</tt>, the associated object is destroyed when this object is. If set to 
    714712      #   <tt>:delete</tt>, the associated object is deleted *without* calling its destroy method. If set to <tt>:nullify</tt>, the associated 
     
    722720      # Option examples: 
    723721      #   has_one :credit_card, :dependent => :destroy  # destroys the associated credit card 
    724       #   has_one :credit_card, :dependent => :nullify  # updates the associated records foreign key value to null rather than destroying it 
     722      #   has_one :credit_card, :dependent => :nullify  # updates the associated records foreign key value to NULL rather than destroying it 
    725723      #   has_one :last_comment, :class_name => "Comment", :order => "posted_on" 
    726724      #   has_one :project_manager, :class_name => "Person", :conditions => "role = 'project_manager'" 
     
    772770      # * <tt>:conditions</tt>  - specify the conditions that the associated object must meet in order to be included as a +WHERE+ 
    773771      #   SQL fragment, such as <tt>authorized = 1</tt>. 
    774       # * <tt>:order</tt>       - specify the order from which the associated object will be picked at the top. Specified as 
    775       #   an <tt>ORDER BY</tt> SQL fragment, such as <tt>last_name, first_name DESC</tt> 
     772      # * <tt>:order</tt>       - specify the order in which the associated objects are returned as an <tt>ORDER BY</tt> SQL fragment, 
     773      #   such as <tt>last_name, first_name DESC</tt> 
    776774      # * <tt>:foreign_key</tt> - specify the foreign key used for the association. By default this is guessed to be the name 
    777775      #   of the associated class in lower-case and +_id+ suffixed. So a +Person+ class that makes a +belongs_to+ association to a 
    778776      #   +Boss+ class will use +boss_id+ as the default +foreign_key+. 
    779       # * <tt>:counter_cache</tt> - caches the number of belonging objects on the associate class through use of +increment_counter+  
     777      # * <tt>:counter_cache</tt> - caches the number of belonging objects on the associate class through the use of +increment_counter+  
    780778      #   and +decrement_counter+. The counter cache is incremented when an object of this class is created and decremented when it's 
    781779      #   destroyed. This requires that a column named <tt>#{table_name}_count</tt> (such as +comments_count+ for a belonging +Comment+ class) 
     
    925923      # * <tt>:conditions</tt>  - specify the conditions that the associated object must meet in order to be included as a +WHERE+ 
    926924      #   SQL fragment, such as <tt>authorized = 1</tt>. 
    927       # * <tt>:order</tt> - specify the order in which the associated objects are returned as a <tt>ORDER BY</tt> SQL fragment, such as <tt>last_name, first_name DESC</tt> 
     925      # * <tt>:order</tt> - specify the order in which the associated objects are returned as an <tt>ORDER BY</tt> SQL fragment, 
     926      #   such as <tt>last_name, first_name DESC</tt> 
    928927      # * <tt>:uniq</tt> - if set to +true+, duplicate associated objects will be ignored by accessors and query methods 
    929928      # * <tt>:finder_sql</tt> - overwrite the default generated SQL statement used to fetch the association with a manual statement 
  • trunk/activerecord/lib/active_record/base.rb

    r8109 r8113  
    4141  end 
    4242 
    43   # Raised when you've tried to access a column, which wasn't 
     43  # Raised when you've tried to access a column which wasn't 
    4444  # loaded by your finder.  Typically this is because :select 
    4545  # has been specified 
     
    7373  # 
    7474  # Active Records accept constructor parameters either in a hash or as a block. The hash method is especially useful when 
    75   # you're receiving the data from somewhere else, like a HTTP request. It works like this: 
     75  # you're receiving the data from somewhere else, like an HTTP request. It works like this: 
    7676  # 
    7777  #   user = User.new(:name => "David", :occupation => "Code Artist") 
     
    113113  # 
    114114  # The <tt>authenticate_unsafely</tt> method inserts the parameters directly into the query and is thus susceptible to SQL-injection 
    115   # attacks if the <tt>user_name</tt> and +password+ parameters come directly from a HTTP request. The <tt>authenticate_safely</tt>  and 
     115  # attacks if the <tt>user_name</tt> and +password+ parameters come directly from an HTTP request. The <tt>authenticate_safely</tt>  and 
    116116  # <tt>authenticate_safely_simply</tt> both will sanitize the <tt>user_name</tt> and +password+ before inserting them in the query,  
    117117  # which will ensure that an attacker can't escape the query and fake the login (or worse). 
     
    138138  # == Overwriting default accessors 
    139139  # 
    140   # All column values are automatically available through basic accessors on the Active Record object, but some times you 
    141   # want to specialize this behavior. This can be done by either by overwriting the default accessors (using the same 
    142   # name as the attribute) calling read_attribute(attr_name) and write_attribute(attr_name, value) to actually change things. 
     140  # All column values are automatically available through basic accessors on the Active Record object, but sometimes you 
     141  # want to specialize this behavior. This can be done by overwriting the default accessors (using the same 
     142  # name as the attribute) and calling read_attribute(attr_name) and write_attribute(attr_name, value) to actually change things. 
    143143  # Example: 
    144144  # 
     
    231231  # == Single table inheritance 
    232232  # 
    233   # Active Record allows inheritance by storing the name of the class in a column that by default is called "type" (can be changed 
     233  # Active Record allows inheritance by storing the name of the class in a column that by default is named "type" (can be changed 
    234234  # by overwriting <tt>Base.inheritance_column</tt>). This means that an inheritance looking like this: 
    235235  # 
     
    252252  # Connections are usually created through ActiveRecord::Base.establish_connection and retrieved by ActiveRecord::Base.connection. 
    253253  # All classes inheriting from ActiveRecord::Base will use this connection. But you can also set a class-specific connection. 
    254   # For example, if Course is a ActiveRecord::Base, but resides in a different database you can just say Course.establish_connection 
     254  # For example, if Course is an ActiveRecord::Base, but resides in a different database, you can just say Course.establish_connection 
    255255  # and Course *and all its subclasses* will use this connection instead. 
    256256  # 
     
    261261  # 
    262262  # * +ActiveRecordError+ -- generic error class and superclass of all other errors raised by Active Record 
    263   # * +AdapterNotSpecified+ -- the configuration hash used in <tt>establish_connection</tt> didn't include a 
     263  # * +AdapterNotSpecified+ -- the configuration hash used in <tt>establish_connection</tt> didn't include an 
    264264  #   <tt>:adapter</tt> key. 
    265   # * +AdapterNotFound+ -- the <tt>:adapter</tt> key used in <tt>establish_connection</tt> specified an non-existent adapter 
     265  # * +AdapterNotFound+ -- the <tt>:adapter</tt> key used in <tt>establish_connection</tt> specified a non-existent adapter 
    266266  #   (or a bad spelling of an existing one). 
    267267  # * +AssociationTypeMismatch+ -- the object assigned to the association wasn't of the type specified in the association definition. 
    268   # * +SerializationTypeMismatch+ -- the object serialized wasn't of the class specified as the second parameter. 
     268  # * +SerializationTypeMismatch+ -- the serialized object wasn't of the class specified as the second parameter. 
    269269  # * +ConnectionNotEstablished+ -- no connection has been established. Use <tt>establish_connection</tt> before querying. 
    270270  # * +RecordNotFound+ -- no record responded to the find* method. 
     
    361361 
    362362    # Determines whether to raise an exception on mass-assignment to protected 
    363     # attribute. Defaults to true. 
     363    # attributes. Defaults to true. 
    364364    cattr_accessor :whiny_protected_attributes, :instance_writer => false 
    365365    @@whiny_protected_attributes = true 
     
    371371      #   If no record can be found for all of the listed ids, then RecordNotFound will be raised. 
    372372      # * Find first: This will return the first record matched by the options used. These options can either be specific 
    373       #   conditions or merely an order. If no record can matched, nil is returned. 
     373      #   conditions or merely an order. If no record can be matched, nil is returned. 
    374374      # * Find all: This will return all the records matched by the options used. If no records are found, an empty array is returned. 
    375375      # 
    376       # All approaches accept an option hash as their last parameter. The options are: 
     376      # All approaches accept an options hash as their last parameter. The options are: 
    377377      # 
    378378      # * <tt>:conditions</tt>: An SQL fragment like "administrator = 1" or [ "user_name = ?", username ]. See conditions in the intro. 
     
    385385      #   The records will be returned read-only since they will have attributes that do not correspond to the table's columns. 
    386386      #   Pass :readonly => false to override. 
     387      #   See adding joins for associations under Associations. 
    387388      # * <tt>:include</tt>: Names associations that should be loaded alongside using LEFT OUTER JOINs. The symbols named refer 
    388389      #   to already defined associations. See eager loading under Associations. 
    389       # * <tt>:select</tt>: By default, this is * as in SELECT * FROM, but can be changed if you for example want to do a join, but not 
     390      # * <tt>:select</tt>: By default, this is * as in SELECT * FROM, but can be changed if you, for example, want to do a join but not 
    390391      #   include the joined columns. 
    391392      # * <tt>:from</tt>: By default, this is the table name of the class, but can be changed to an alternate table name (or even the name 
     
    399400      #   Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6) 
    400401      #   Person.find([7, 17]) # returns an array for objects with IDs in (7, 17) 
    401       #   Person.find([1])     # returns an array for objects the object with ID = 1 
     402      #   Person.find([1])     # returns an array for the object with ID = 1 
    402403      #   Person.find(1, :conditions => "administrator = 1", :order => "created_on DESC") 
    403404      # 
     
    430431      def find(*args) 
    431432        options = args.extract_options! 
     433        # Note:  we extract any :joins option with a non-string value from the options, and turn it into 
     434        #  an internal option :ar_joins.  This allows code called from here to find the ar_joins, and 
     435        #  it bypasses marking the result as read_only. 
     436        #  A normal string join marks the result as read-only because it contains attributes from joined tables 
     437        #  which are not in the base table and therefore prevent the result from being saved. 
     438        #  In the case of an ar_join, the JoinDependency created to instantiate the results eliminates these 
     439        #  bogus attributes.  See JoinDependency#instantiate, and JoinBase#instantiate in associations.rb. 
    432440        validate_find_options(options) 
    433441        set_readonly_option!(options) 
     
    522530      end 
    523531 
    524       # Destroys the objects for all the records that match the +condition+ by instantiating each object and calling 
     532      # Destroys the objects for all the records that match the +conditions+ by instantiating each object and calling 
    525533      # the destroy method. Example: 
    526534      #   Person.destroy_all "last_login < '2004-04-04'" 
     
    529537      end 
    530538 
    531       # Deletes all the records that match the +condition+ without instantiating the objects first (and hence not 
     539      # Deletes all the records that match the +conditions+ without instantiating the objects first (and hence not 
    532540      # calling the destroy method). Example: 
    533541      #   Post.delete_all "person_id = 5 AND (category = 'Something' OR category = 'Else')" 
     
    577585      # This is used for caching aggregate values, so that they don't need to be computed every time.  
    578586      # For example, a DiscussionBoard may cache post_count and comment_count otherwise every time the board is  
    579       # shown it would have to run a SQL query to find how many posts and comments there are. 
     587      # shown it would have to run an SQL query to find how many posts and comments there are. 
    580588      # 
    581589      # ==== Options 
     
    688696      # 
    689697      # +attr_name+   The field name that should be serialized 
    690       # +class_name+  Optional, class name that the object should be equal to 
     698      # +class_name+  Optional, class name that the object type should be equal to 
    691699      # 
    692700      # ==== Example 
     
    708716      # directly from ActiveRecord. So if the hierarchy looks like: Reply < Message < ActiveRecord, then Message is used 
    709717      # to guess the table name from even when called on Reply. The rules used to do the guess are handled by the Inflector class 
    710       # in Active Support, which knows almost all common English inflections (report a bug if your inflection isn't covered)
     718      # in Active Support, which knows almost all common English inflections. You can add new inflections in config/initializers/inflections.rb
    711719      # 
    712720      # Nested classes are given table names prefixed by the singular form of 
     
    965973      end 
    966974 
    967       # Used to sanitize objects before they're used in an SELECT SQL-statement. Delegates to <tt>connection.quote</tt>. 
     975      # Used to sanitize objects before they're used in an SQL SELECT statement. Delegates to <tt>connection.quote</tt>. 
    968976      def sanitize(object) #:nodoc: 
    969977        connection.quote(object) 
     
    12671275        # Enables dynamic finders like find_by_user_name(user_name) and find_by_user_name_and_password(user_name, password) that are turned into 
    12681276        # find(:first, :conditions => ["user_name = ?", user_name]) and  find(:first, :conditions => ["user_name = ? AND password = ?", user_name, password]) 
    1269         # respectively. Also works for find(:all), but using find_all_by_amount(50) that are turned into find(:all, :conditions => ["amount = ?", 50]). 
     1277        # respectively. Also works for find(:all) by using find_all_by_amount(50) that is turned into find(:all, :conditions => ["amount = ?", 50]). 
    12701278        # 
    12711279        # It's even possible to use all the additional parameters to find. For example, the full interface for find_all_by_amount 
     
    14361444        #   end 
    14371445        # 
    1438         # You can ignore any previous scopings by using <tt>with_exclusive_scope</tt> method. 
     1446        # You can ignore any previous scopings by using the <tt>with_exclusive_scope</tt> method. 
    14391447        # 
    14401448        #   class Article < ActiveRecord::Base 
     
    18901898      # matching the attribute names (which again matches the column names). Sensitive attributes can be protected 
    18911899      # from this form of mass-assignment by using the +attr_protected+ macro. Or you can alternatively 
    1892       # specify which attributes *can* be accessed in with the +attr_accessible+ macro. Then all the 
     1900      # specify which attributes *can* be accessed with the +attr_accessible+ macro. Then all the 
    18931901      # attributes not included in that won't be allowed to be mass-assigned.  
    18941902      def attributes=(new_attributes, guard_protected_attributes = true) 
     
    21212129      end 
    21222130 
    2123       # Returns copy of the attributes hash where all the values have been safely quoted for use in 
     2131      # Returns a copy of the attributes hash where all the values have been safely quoted for use in 
    21242132      # an SQL statement. 
    21252133      def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true) 
     
    21602168      # written_on (a date type) with Date.new("2004", "6", "24"). You can also specify a typecast character in the 
    21612169      # parentheses to have the parameters typecasted before they're used in the constructor. Use i for Fixnum, f for Float, 
    2162       # s for String, and a for Array. If all the values for a given attribute is empty, the attribute will be set to nil. 
     2170      # s for String, and a for Array. If all the values for a given attribute are empty, the attribute will be set to nil. 
    21632171      def assign_multiparameter_attributes(pairs) 
    21642172        execute_callstack_for_multiparameter_attributes( 
  • trunk/activerecord/lib/active_record/calculations.rb

    r8109 r8113  
    1616      # 
    1717      # * <tt>:conditions</tt>: An SQL fragment like "administrator = 1" or [ "user_name = ?", username ]. See conditions in the intro. 
    18       # * <tt>:joins</tt>: An SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id". (Rarely needed). 
    19       #   The records will be returned read-only since they will have attributes that do not correspond to the table's columns. 
     18      # * <tt>:joins</tt>: Either an SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id". (Rarely needed). 
     19      #    or names associations in the same form used for the :include option. 
     20      #   If the value is a string, then the records will be returned read-only since they will have attributes that do not correspond to the table's columns. 
     21      #   Pass :readonly => false to override. 
     22      #   See adding joins for associations under Associations. 
    2023      # * <tt>:include</tt>: Named associations that should be loaded alongside using LEFT OUTER JOINs. The symbols named refer 
    21       #   to already defined associations. When using named associations count returns the number DISTINCT items for the model you're counting. 
     24      #   to already defined associations. When using named associations, count returns the number of DISTINCT items for the model you're counting. 
    2225      #   See eager loading under Associations. 
    2326      # * <tt>:order</tt>: An SQL fragment like "created_at DESC, name" (really only used with GROUP BY calculations). 
    2427      # * <tt>:group</tt>: An attribute name by which the result should be grouped. Uses the GROUP BY SQL-clause. 
    25       # * <tt>:select</tt>: By default, this is * as in SELECT * FROM, but can be changed if you for example want to do a join, but not 
     28      # * <tt>:select</tt>: By default, this is * as in SELECT * FROM, but can be changed if you, for example, want to do a join but not 
    2629      #   include the joined columns. 
    2730      # * <tt>:distinct</tt>: Set this to true to make this a distinct calculation, such as SELECT COUNT(DISTINCT posts.id) ... 
     
    4548      end 
    4649 
    47       # Calculates average value on a given column.  The value is returned as a float.  See #calculate for examples with options. 
     50      # Calculates the average value on a given column.  The value is returned as a float.  See #calculate for examples with options. 
    4851      # 
    4952      #   Person.average('age') 
     
    5255      end 
    5356 
    54       # Calculates the minimum value on a given column.  The value is returned with the same data type of the column..  See #calculate for examples with options. 
     57      # Calculates the minimum value on a given column.  The value is returned with the same data type of the column.  See #calculate for examples with options. 
    5558      # 
    5659      #   Person.minimum('age') 
     
    5962      end 
    6063 
    61       # Calculates the maximum value on a given column.  The value is returned with the same data type of the column..  See #calculate for examples with options. 
     64      # Calculates the maximum value on a given column.  The value is returned with the same data type of the column.  See #calculate for examples with options. 
    6265      # 
    6366      #   Person.maximum('age') 
     
    6669      end 
    6770 
    68       # Calculates the sum value on a given column.  The value is returned with the same data type of the column..  See #calculate for examples with options. 
     71      # Calculates the sum of values on a given column.  The value is returned with the same data type of the column.  See #calculate for examples with options. 
    6972      # 
    7073      #   Person.sum('age') 
     
    7376      end 
    7477 
    75       # This calculates aggregate values in the given column:  Methods for count, sum, average, minimum, and maximum have been added as shortcuts. 
     78      # This calculates aggregate values in the given column.  Methods for count, sum, average, minimum, and maximum have been added as shortcuts. 
    7679      # Options such as :conditions, :order, :group, :having, and :joins can be passed to customize the query. 
    7780      # 
     
    238241 
    239242        # Converts a given key to the value that the database adapter returns as 
    240         # as a usable column name. 
     243        # a usable column name. 
    241244        #   users.id #=> users_id 
    242245        #   sum(id) #=> sum_id 
  • trunk/activerecord/lib/active_record/callbacks.rb

    r7380 r8113  
    162162  # 
    163163  # If the returning value of a +before_validation+ callback can be evaluated to +false+, the process will be aborted and <tt>Base#save</tt> will return +false+. 
    164   # If <tt>Base#save!</tt> is called it will raise a +RecordNotSave+ exception. 
     164  # If <tt>Base#save!</tt> is called it will raise a +RecordNotSaved+ exception. 
    165165  # Nothing will be appended to the errors object. 
    166166  # 
  • trunk/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb

    r8014 r8113  
    244244 
    245245    # Locate the connection of the nearest super class. This can be an 
    246     # active or defined connections: if it is the latter, it will be 
     246    # active or defined connection: if it is the latter, it will be 
    247247    # opened and set as the active connection for the class it was defined 
    248248    # for (not necessarily the current class). 
     
    265265    end 
    266266 
    267     # Returns true if a connection that's accessible to this class have already been opened. 
     267    # Returns true if a connection that's accessible to this class has already been opened. 
    268268    def self.connected? 
    269269      active_connections[active_connection_name] ? true : false 
     
    272272    # Remove the connection for this class. This will close the active 
    273273    # connection and the defined connection (if they exist). The result 
    274     # can be used as argument for establish_connection, for eas
    275     # re-establishing of the connection. 
     274    # can be used as an argument for establish_connection, for easil
     275    # re-establishing the connection. 
    276276    def self.remove_connection(klass=self) 
    277277      spec = @@defined_connections[klass.name] 
  • trunk/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb

    r7932 r8113  
    9999      end 
    100100 
    101       # Appends +LIMIT+ and +OFFSET+ options to a SQL statement. 
     101      # Appends +LIMIT+ and +OFFSET+ options to an SQL statement. 
    102102      # This method *modifies* the +sql+ parameter. 
    103103      # ===== Examples 
     
    114114      end 
    115115 
    116       # Appends a locking clause to a SQL statement. *Modifies the +sql+ parameter*. 
     116      # Appends a locking clause to an SQL statement. 
     117      # This method *modifies* the +sql+ parameter. 
    117118      #   # SELECT * FROM suppliers FOR UPDATE 
    118119      #   add_lock! 'SELECT * FROM suppliers', :lock => true 
  • trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

    r8106 r8113  
    273273 
    274274    # Represents a SQL table in an abstract way. 
    275     # Columns are stored as ColumnDefinition in the #columns attribute. 
     275    # Columns are stored as a ColumnDefinition in the #columns attribute. 
    276276    class TableDefinition 
    277277      attr_accessor :columns 
     
    452452 
    453453      # Returns a String whose contents are the column definitions 
    454       # concatenated together.  This string can then be pre and appended to 
     454      # concatenated together.  This string can then be prepended and appended to 
    455455      # to generate the final SQL to create the table. 
    456456      def to_sql 
  • trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb

    r7932 r8113  
    5555      #   Make a temporary table. 
    5656      # [<tt>:force</tt>] 
    57       #   Set to true or false to drop the table before creating it. 
     57      #   Set to true to drop the table before creating it. 
    5858      #   Defaults to false. 
    5959      # 
     
    161161      # an Array of Symbols. 
    162162      # 
    163       # The index will be named after the table and the first column names
     163      # The index will be named after the table and the first column name
    164164      # unless you pass +:name+ as an option. 
    165165      # 
     
    167167      # for the index. For example, when you specify an index on two columns 
    168168      # [+:first+, +:last+], the DBMS creates an index for both columns as well as an 
    169       # index for the first colum +:first+. Using just the first name for this index 
     169      # index for the first column +:first+. Using just the first name for this index 
    170170      # makes sense, because you will never have to create a singular index with this 
    171171      # name. 
  • trunk/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

    r8036 r8113  
    1919      end 
    2020 
    21       # The postgres drivers don't allow to create an unconnected PGconn object, 
     21      # The postgres drivers don't allow the creation of an unconnected PGconn object, 
    2222      # so just pass a nil connection object for the time being. 
    2323      ConnectionAdapters::PostgreSQLAdapter.new(nil, logger, [host, port, nil, nil, database, username, password], config) 
     
    218218    # * <tt>:database</tt> -- The name of the database. No default, must be provided. 
    219219    # * <tt>:schema_search_path</tt> -- An optional schema search path for the connection given as a string of comma-separated schema names.  This is backward-compatible with the :schema_order option. 
    220     # * <tt>:encoding</tt> -- An optional client encoding that is using in a SET client_encoding TO <encoding> call on connection. 
    221     # * <tt>:min_messages</tt> -- An optional client min messages that is using in a SET client_min_messages TO <min_messages> call on connection. 
     220    # * <tt>:encoding</tt> -- An optional client encoding that is used in a SET client_encoding TO <encoding> call on the connection. 
     221    # * <tt>:min_messages</tt> -- An optional client min messages that is used in a SET client_min_messages TO <min_messages> call on the connection. 
    222222    # * <tt>:allow_concurrency</tt> -- If true, use async query methods so Ruby threads don't deadlock; otherwise, use blocking query methods. 
    223223    class PostgreSQLAdapter < AbstractAdapter 
     
    399399      end 
    400400 
    401       # Executes a SQL statement, returning a PGresult object on success 
     401      # Executes an SQL statement, returning a PGresult object on success 
    402402      # or raising a PGError exception otherwise. 
    403403      def execute(sql, name = nil) 
     
    479479      # Returns the list of all column definitions for a table. 
    480480      def columns(table_name, name = nil) 
    481         # Limit, precision, and scale are all handled by superclass. 
     481        # Limit, precision, and scale are all handled by the superclass. 
    482482        column_definitions(table_name).collect do |name, type, default, notnull| 
    483483          PostgreSQLColumn.new(name, default, type, notnull == 'f') 
     
    670670      end 
    671671       
    672       # Returns a ORDER BY clause for the passed order option. 
     672      # Returns an ORDER BY clause for the passed order option. 
    673673      #  
    674674      # PostgreSQL does not allow arbitrary ordering when using DISTINCT ON, so we work around this 
     
    762762 
    763763        # Executes a SELECT query and returns the results, performing any data type 
    764         # conversions that require to be performed here instead of in PostgreSQLColumn. 
     764        # conversions that are required to be performed here instead of in PostgreSQLColumn. 
    765765        def select(sql, name = nil) 
    766766          fields, rows = select_raw(sql, name) 
     
    792792                if res.type(cell_index) == MONEY_COLUMN_TYPE_OID 
    793793                  # Because money output is formatted according to the locale, there are two 
    794                   # cases to consider (note the decimal seperators): 
     794                  # cases to consider (note the decimal separators): 
    795795                  #  (1) $12,345,678.12         
    796796                  #  (2) $12.345.678,12 
  • trunk/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb

    r7753 r8113  
    3535          # Allow database path relative to RAILS_ROOT, but only if 
    3636          # the database path is not the special path that tells 
    37           # Sqlite build a database only in memory. 
     37          # Sqlite to build a database only in memory. 
    3838          if Object.const_defined?(:RAILS_ROOT) && ':memory:' != config[:database] 
    3939            config[:database] = File.expand_path(config[:database], RAILS_ROOT) 
  • trunk/activerecord/lib/active_record/fixtures.rb

    r8060 r8113  
    1313end 
    1414 
    15 # Fixtures are a way of organizing data that you want to test against; in short, sample data. They come in 3 flavours: 
     15# Fixtures are a way of organizing data that you want to test against; in short, sample data. They come in 3 flavors: 
    1616# 
    1717#   1.  YAML fixtures 
     
    2222# 
    2323# This type of fixture is in YAML format and the preferred default. YAML is a file format which describes data structures 
    24 # in a non-verbose, humanly-readable format. It ships with Ruby 1.8.1+. 
     24# in a non-verbose, human-readable format. It ships with Ruby 1.8.1+. 
    2525# 
    2626# Unlike single-file fixtures, YAML fixtures are stored in a single file per model, which are placed in the directory appointed 
     
    8383# = Single-file fixtures 
    8484# 
    85 # This type of fixtures was the original format for Active Record that has since been deprecated in favor of the YAML and CSV formats. 
     85# This type of fixture was the original format for Active Record that has since been deprecated in favor of the YAML and CSV formats. 
    8686# Fixtures for this format are created by placing text files in a sub-directory (with the name of the model) to the directory 
    8787# appointed by <tt>Test::Unit::TestCase.fixture_path=(path)</tt> (this is automatically configured for Rails, so you can just 
     
    107107# 
    108108# Since fixtures are a testing construct, we use them in our unit and functional tests.  There are two ways to use the 
    109 # fixtures, but first let's take a look at a sample unit test found
     109# fixtures, but first let's take a look at a sample unit test
    110110# 
    111111#   require 'web_site' 
     
    125125#   ... 
    126126# 
    127 # By adding a "fixtures" method to the test case and passing it a list of symbols (only one is shown here tho), we trigger 
     127# By adding a "fixtures" method to the test case and passing it a list of symbols (only one is shown here though), we trigger 
    128128# the testing environment to automatically load the appropriate fixtures into the database before each test. 
    129129# To ensure consistent data, the environment deletes the fixtures before running the load. 
     
    213213#   1. You're testing whether a transaction works correctly. Nested transactions don't commit until all parent transactions commit, 
    214214#      particularly, the fixtures transaction which is begun in setup and rolled back in teardown. Thus, you won't be able to verify 
    215 #      the results of your transaction until Active Record supports nested transactions or savepoints (in progress.) 
     215#      the results of your transaction until Active Record supports nested transactions or savepoints (in progress). 
    216216#   2. Your database does not support transactions. Every Active Record database supports transactions except MySQL MyISAM. 
    217217#      Use InnoDB, MaxDB, or NDB instead. 
     
    261261# Specifying foreign keys in fixtures can be very fragile, not to 
    262262# mention difficult to read. Since ActiveRecord can figure out the ID of 
    263 # and fixture from its label, you can specify FK's by label instead of ID. 
     263# any fixture from its label, you can specify FK's by label instead of ID. 
    264264# 
    265265# === belongs_to 
  • trunk/activerecord/lib/active_record/migration.rb

    r8031 r8113  
    3333  #   end 
    3434  # 
    35   # This migration will add a boolean flag to the accounts table and remove it again, if you're backing out of the migration. 
     35  # This migration will add a boolean flag to the accounts table and remove it if you're backing out of the migration. 
    3636  # It shows how all migrations have two class methods +up+ and +down+ that describes the transformations required to implement 
    37   # or remove the migration. These methods can consist of both the migration specific methods, like add_column and remove_column, 
     37  # or remove the migration. These methods can consist of both the migration specific methods like add_column and remove_column, 
    3838  # but may also contain regular Ruby code for generating data needed for the transformations. 
    3939  # 
     
    7979  #   parameters as add_column. 
    8080  # * <tt>remove_column(table_name, column_name)</tt>: Removes the column named +column_name+ from the table called +table_name+. 
    81   # * <tt>add_index(table_name, column_names, options)</tt>: Add a new index with the name of the column. Other options include 
     81  # * <tt>add_index(table_name, column_names, options)</tt>: Adds a new index with the name of the column. Other options include 
    8282  #   :name and :unique (e.g. { :name => "users_name_index", :unique => true }). 
    83   # * <tt>remove_index(table_name, index_name)</tt>: Remove the index specified by +index_name+. 
     83  # * <tt>remove_index(table_name, index_name)</tt>: Removes the index specified by +index_name+. 
    8484  # 
    8585  # == Irreversible transformations 
     
    9595  # where MyNewMigration is the name of your migration. The generator will 
    9696  # create a file <tt>nnn_my_new_migration.rb</tt> in the <tt>db/migrate/</tt> 
    97   # directory, where <tt>nnn</tt> is the next largest migration number. 
     97  # directory where <tt>nnn</tt> is the next largest migration number. 
    9898  # You may then edit the <tt>self.up</tt> and <tt>self.down</tt> methods of 
    99   # n MyNewMigration. 
     99  # MyNewMigration. 
    100100  # 
    101101  # To run migrations against the currently configured database, use 
  • trunk/activerecord/lib/active_record/reflection.rb

    r7188 r8113  
    4545      end 
    4646 
    47       # Returns an array of AssociationReflection objects for all the aggregations in the class. If you only want to reflect on a 
     47      # Returns an array of AssociationReflection objects for all the associations in the class. If you only want to reflect on a 
    4848      # certain association type, pass in the symbol (:has_many, :has_one, :belongs_to) for that as the first parameter.  
    4949      # Example: 
     
    5757      end 
    5858 
    59       # Returns the AssociationReflection object for the named +aggregation+ (use the symbol). Example: 
     59      # Returns the AssociationReflection object for the named +association+ (use the symbol). Example: 
    6060      # 
    6161      #   Account.reflect_on_association(:owner) # returns the owner AssociationReflection 
  • trunk/activerecord/lib/active_record/serializers/xml_serializer.rb

    r8092 r8113  
    22  module Serialization 
    33    # Builds an XML document to represent the model.   Some configuration is 
    4     # available through +options+, however more complicated cases should use  
     4    # available through +options+, however more complicated cases should  
    55    # override ActiveRecord's to_xml. 
    66    # 
     
    108108    #   </firm> 
    109109    # 
    110     # You may override the to_xml method in your ActiveRecord::Base 
     110    # You can override the to_xml method in your ActiveRecord::Base 
    111111    # subclasses if you need to.  The general form of doing this is 
    112112    # 
  • trunk/activerecord/lib/active_record/timestamp.rb

    r6789 r8113  
    11module ActiveRecord 
    2   # Active Record automatically timestamps create and update if the table has fields 
    3   # created_at/created_on or updated_at/updated_on. 
     2  # Active Record automatically timestamps create and update operations if the table has fields 
     3  # named created_at/created_on or updated_at/updated_on. 
    44  # 
    55  # Timestamping can be turned off by setting 
  • trunk/activerecord/lib/active_record/transactions.rb

    r8097 r8113  
    7676    # Both Base#save and Base#destroy come wrapped in a transaction that ensures that whatever you do in validations or callbacks 
    7777    # will happen under the protected cover of a transaction. So you can use validations to check for values that the transaction 
    78     # depend on or you can raise exceptions in the callbacks to rollback. 
     78    # depends on or you can raise exceptions in the callbacks to rollback. 
    7979    # 
    8080    # == Exception handling 
  • trunk/activerecord/lib/active_record/validations.rb

    r8000 r8113  
    1616 
    1717  # Active Record validation is reported to and from this object, which is used by Base#save to 
    18   # determine whether the object in a valid state to be saved. See usage example in Validations. 
     18  # determine whether the object is in a valid state to be saved. See usage example in Validations. 
    1919  class Errors 
    2020    include Enumerable 
     
    4646    } 
    4747 
    48     # Holds a hash with all the default error messages, such that they can be replaced by your own copy or localizations. 
     48    # Holds a hash with all the default error messages that can be replaced by your own copy or localizations. 
    4949    cattr_accessor :default_error_messages 
    5050 
     
    119119    alias :[] :on 
    120120 
    121     # Returns errors assigned to base object through add_to_base according to the normal rules of on(attribute). 
     121    # Returns errors assigned to the base object through add_to_base according to the normal rules of on(attribute). 
    122122    def on_base 
    123123      on(:base)