Skip to content

Commit

Permalink
Remove extra white spaces on ActiveRecord docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
smartinez87 committed May 23, 2011
1 parent 2a4b780 commit 0034b78
Show file tree
Hide file tree
Showing 25 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/aggregations.rb
Expand Up @@ -176,7 +176,7 @@ module ClassMethods
# order in which mappings are defined determine the order in which attributes are sent to the
# value class constructor.
# * <tt>:allow_nil</tt> - Specifies that the value object will not be instantiated when all mapped
# attributes are +nil+. Setting the value object to +nil+ has the effect of writing +nil+ to all
# attributes are +nil+. Setting the value object to +nil+ has the effect of writing +nil+ to all
# mapped attributes.
# This defaults to +false+.
# * <tt>:constructor</tt> - A symbol specifying the name of the constructor method or a Proc that
Expand Down
Expand Up @@ -126,7 +126,7 @@ def create!(attrs = {}, options = {}, &block)
record
end

# Add +records+ to this association. Returns +self+ so method calls may be chained.
# Add +records+ to this association. Returns +self+ so method calls may be chained.
# Since << flattens its argument list and inserts each record, +push+ and +concat+ behave identically.
def concat(*records)
result = true
Expand Down
Expand Up @@ -18,7 +18,7 @@ def insert_record(record, validate = true)
#
# If the association has a counter cache it gets that value. Otherwise
# it will attempt to do a count via SQL, bounded to <tt>:limit</tt> if
# there's one. Some configuration options like :group make it impossible
# there's one. Some configuration options like :group make it impossible
# to do an SQL count, in those cases the array count will be used.
#
# That does not depend on whether the collection has already been loaded
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/attribute_methods/read.rb
Expand Up @@ -58,7 +58,7 @@ def define_read_method_for_serialized_attribute(attr_name)
generated_attribute_methods.module_eval("def _#{attr_name}; #{access_code}; end; alias #{attr_name} _#{attr_name}", __FILE__, __LINE__)
end

# Define an attribute reader method. Cope with nil column.
# Define an attribute reader method. Cope with nil column.
# method_name is the same as attr_name except when a non-standard primary key is used,
# we still define #id as an accessor for the key
def define_read_method(method_name, attr_name, column)
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/autosave_association.rb
Expand Up @@ -161,7 +161,7 @@ def define_non_cyclic_method(name, reflection, &block)
#
# For performance reasons, we don't check whether to validate at runtime.
# However the validation and callback methods are lazy and those methods
# get created when they are invoked for the very first time. However,
# get created when they are invoked for the very first time. However,
# this can change, for instance, when using nested attributes, which is
# called _after_ the association has been defined. Since we don't want
# the callbacks to get defined multiple times, there are guards that
Expand Down
Expand Up @@ -165,7 +165,7 @@ def release_connection(with_id = current_connection_id)
checkin conn if conn
end

# If a connection already exists yield it to the block. If no connection
# If a connection already exists yield it to the block. If no connection
# exists checkout a connection, yield it to the block, and checkin the
# connection when finished.
def with_connection
Expand Down
Expand Up @@ -42,7 +42,7 @@ def execute(sql, name = nil)
undef_method :execute

# Executes +sql+ statement in the context of this connection using
# +binds+ as the bind substitutes. +name+ is logged along with
# +binds+ as the bind substitutes. +name+ is logged along with
# the executed +sql+ statement.
def exec_query(sql, name = 'SQL', binds = [])
end
Expand Down Expand Up @@ -276,7 +276,7 @@ def default_sequence_name(table, column)

# Set the sequence to the max value of the table's column.
def reset_sequence!(table, column, sequence = nil)
# Do nothing by default. Implement for PostgreSQL, Oracle, ...
# Do nothing by default. Implement for PostgreSQL, Oracle, ...
end

# Inserts the given fixture into the table. Overridden in adapters that require
Expand Down
Expand Up @@ -4,7 +4,7 @@ module ActiveRecord
module ConnectionAdapters # :nodoc:
module SchemaStatements
# Returns a Hash of mappings from the abstract data types to the native
# database types. See TableDefinition#column for details on the recognized
# database types. See TableDefinition#column for details on the recognized
# abstract data types.
def native_database_types
{}
Expand Down Expand Up @@ -78,7 +78,7 @@ def column_exists?(table_name, column_name, type = nil, options = {})
# Creates a new table with the name +table_name+. +table_name+ may either
# be a String or a Symbol.
#
# There are two ways to work with +create_table+. You can use the block
# There are two ways to work with +create_table+. You can use the block
# form or the regular form, like this:
#
# === Block form
Expand Down Expand Up @@ -299,7 +299,7 @@ def rename_column(table_name, column_name, new_column_name)
raise NotImplementedError, "rename_column is not implemented"
end

# Adds a new index to the table. +column_name+ can be a single Symbol, or
# Adds a new index to the table. +column_name+ can be a single Symbol, or
# an Array of Symbols.
#
# The index will be named after the table and the first column name,
Expand Down
Expand Up @@ -407,7 +407,7 @@ def last_inserted_id(result)

def exec_without_stmt(sql, name = 'SQL') # :nodoc:
# Some queries, like SHOW CREATE TABLE don't work through the prepared
# statement API. For those queries, we need to use this method. :'(
# statement API. For those queries, we need to use this method. :'(
log(sql, name) do
result = @connection.query(sql)
cols = []
Expand Down Expand Up @@ -833,7 +833,7 @@ def exec_stmt(sql, name, binds)
stmt.execute(*binds.map { |col, val| type_cast(val, col) })
rescue Mysql::Error => e
# Older versions of MySQL leave the prepared statement in a bad
# place when an error occurs. To support older mysql versions, we
# place when an error occurs. To support older mysql versions, we
# need to close the statement and delete the statement from the
# cache.
stmt.close
Expand Down
Expand Up @@ -199,7 +199,7 @@ def self.extract_value_from_default(default)
# * <tt>:password</tt> - Defaults to nothing.
# * <tt>:database</tt> - The name of the database. No default, must be provided.
# * <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 <tt>:schema_order</tt> option.
# as a string of comma-separated schema names. This is backward-compatible with the <tt>:schema_order</tt> option.
# * <tt>:encoding</tt> - An optional client encoding that is used in a <tt>SET client_encoding TO
# <encoding></tt> call on the connection.
# * <tt>:min_messages</tt> - An optional client min messages that is used in a
Expand Down Expand Up @@ -619,7 +619,7 @@ def recreate_database(name) #:nodoc:
create_database(name)
end

# Create a new PostgreSQL database. Options include <tt>:owner</tt>, <tt>:template</tt>,
# Create a new PostgreSQL database. Options include <tt>:owner</tt>, <tt>:template</tt>,
# <tt>:encoding</tt>, <tt>:tablespace</tt>, and <tt>:connection_limit</tt> (note that MySQL uses
# <tt>:charset</tt> while PostgreSQL uses <tt>:encoding</tt>).
#
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/counter_cache.rb
Expand Up @@ -2,7 +2,7 @@ module ActiveRecord
# = Active Record Counter Cache
module CounterCache
# Resets one or more counter caches to their correct value using an SQL
# count query. This is useful when adding new counter caches, or if the
# count query. This is useful when adding new counter caches, or if the
# counter has been corrupted or modified directly by SQL.
#
# ==== Parameters
Expand Down
12 changes: 6 additions & 6 deletions activerecord/lib/active_record/fixtures.rb
Expand Up @@ -54,14 +54,14 @@ class FixturesFileNotFound < StandardError; end
# name: Google
# url: http://www.google.com
#
# This YAML fixture file includes two fixtures. Each YAML fixture (ie. record) is given a name and is followed by an
# indented list of key/value pairs in the "key: value" format. Records are separated by a blank line for your viewing
# This YAML fixture file includes two fixtures. Each YAML fixture (ie. record) is given a name and is followed by an
# indented list of key/value pairs in the "key: value" format. Records are separated by a blank line for your viewing
# pleasure.
#
# Note that YAML fixtures are unordered. If you want ordered fixtures, use the omap YAML type.
# See http://yaml.org/type/omap.html
# for the specification. You will need ordered fixtures when you have foreign key constraints on keys in the same table.
# This is commonly needed for tree structures. Example:
# for the specification. You will need ordered fixtures when you have foreign key constraints on keys in the same table.
# This is commonly needed for tree structures. Example:
#
# --- !omap
# - parent:
Expand All @@ -75,7 +75,7 @@ class FixturesFileNotFound < StandardError; end
#
# = Using fixtures in testcases
#
# Since fixtures are a testing construct, we use them in our unit and functional tests. There are two ways to use the
# Since fixtures are a testing construct, we use them in our unit and functional tests. There are two ways to use the
# fixtures, but first let's take a look at a sample unit test:
#
# require 'test_helper'
Expand Down Expand Up @@ -558,7 +558,7 @@ def size
fixtures.size
end

# Return a hash of rows to be inserted. The key is the table, the value is
# Return a hash of rows to be inserted. The key is the table, the value is
# a list of rows to insert to that table.
def table_rows
now = ActiveRecord::Base.default_timezone == :utc ? Time.now.utc : Time.now
Expand Down
6 changes: 3 additions & 3 deletions activerecord/lib/active_record/migration/command_recorder.rb
@@ -1,7 +1,7 @@
module ActiveRecord
class Migration
# ActiveRecord::Migration::CommandRecorder records commands done during
# a migration and knows how to reverse those commands. The CommandRecorder
# a migration and knows how to reverse those commands. The CommandRecorder
# knows how to invert the following commands:
#
# * add_column
Expand All @@ -20,7 +20,7 @@ def initialize(delegate = nil)
@delegate = delegate
end

# record +command+. +command+ should be a method name and arguments.
# record +command+. +command+ should be a method name and arguments.
# For example:
#
# recorder.record(:method_name, [:arg1, arg2])
Expand All @@ -29,7 +29,7 @@ def record(*command)
end

# Returns a list that represents commands that are the inverse of the
# commands stored in +commands+. For example:
# commands stored in +commands+. For example:
#
# recorder.record(:rename_table, [:old, :new])
# recorder.inverse # => [:rename_table, [:new, :old]]
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/reflection.rb
Expand Up @@ -380,7 +380,7 @@ def derive_foreign_key
class ThroughReflection < AssociationReflection #:nodoc:
delegate :foreign_key, :foreign_type, :association_foreign_key, :active_record_primary_key, :to => :source_reflection

# Gets the source of the through reflection. It checks both a singularized
# 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>.
#
# class Post < ActiveRecord::Base
Expand Down
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/relation.rb
Expand Up @@ -287,7 +287,7 @@ def destroy_all(conditions = nil)
end

# Destroy an object (or multiple objects) that has the given id, the object is instantiated first,
# therefore all callbacks and filters are fired off before the object is deleted. This method is
# therefore all callbacks and filters are fired off before the object is deleted. This method is
# less efficient than ActiveRecord#delete but allows cleanup methods and other actions to be run.
#
# This essentially finds the object (or multiple objects) with the given id, creates a new object
Expand Down Expand Up @@ -316,7 +316,7 @@ def destroy(id)
# Deletes the records matching +conditions+ without instantiating the records first, and hence not
# calling the +destroy+ method nor invoking callbacks. This is a single SQL DELETE statement that
# goes straight to the database, much more efficient than +destroy_all+. Be careful with relations
# though, in particular <tt>:dependent</tt> rules defined on associations are not honored. Returns
# though, in particular <tt>:dependent</tt> rules defined on associations are not honored. Returns
# the number of rows affected.
#
# ==== Parameters
Expand Down
8 changes: 4 additions & 4 deletions activerecord/lib/active_record/relation/calculations.rb
Expand Up @@ -66,7 +66,7 @@ def average(column_name, options = {})
calculate(:average, column_name, options)
end

# Calculates the minimum value on a given column. The value is returned
# Calculates the minimum value on a given column. The value is returned
# with the same data type of the column, or +nil+ if there's no row. See
# +calculate+ for examples with options.
#
Expand All @@ -93,15 +93,15 @@ def sum(column_name, options = {})
calculate(:sum, column_name, options)
end

# This calculates aggregate values in the given column. Methods for count, sum, average,
# This calculates aggregate values in the given column. Methods for count, sum, average,
# minimum, and maximum have been added as shortcuts. Options such as <tt>:conditions</tt>,
# <tt>:order</tt>, <tt>:group</tt>, <tt>:having</tt>, and <tt>:joins</tt> can be passed to customize the query.
#
# There are two basic forms of output:
# * Single aggregate value: The single value is type cast to Fixnum for COUNT, Float
# for AVG, and the given column's type for everything else.
# * Grouped values: This returns an ordered hash of the values and groups them by the
# <tt>:group</tt> option. It takes either a column name, or the name of a belongs_to association.
# <tt>:group</tt> option. It takes either a column name, or the name of a belongs_to association.
#
# values = Person.maximum(:age, :group => 'last_name')
# puts values["Drake"]
Expand All @@ -119,7 +119,7 @@ def sum(column_name, options = {})
# Options:
# * <tt>:conditions</tt> - An SQL fragment like "administrator = 1" or [ "user_name = ?", username ].
# See conditions in the intro to ActiveRecord::Base.
# * <tt>:include</tt>: Eager loading, see Associations for details. Since calculations don't load anything,
# * <tt>:include</tt>: Eager loading, see Associations for details. Since calculations don't load anything,
# the purpose of this is to access fields on joined tables in your conditions, order, or group clauses.
# * <tt>:joins</tt> - An SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id".
# (Rarely needed).
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/relation/finder_methods.rb
Expand Up @@ -83,7 +83,7 @@ module FinderMethods
#
# Example for find with a lock: Imagine two concurrent transactions:
# each will read <tt>person.visits == 2</tt>, add 1 to it, and save, resulting
# in two saves of <tt>person.visits = 3</tt>. By locking the row, the second
# in two saves of <tt>person.visits = 3</tt>. By locking the row, the second
# transaction has to wait until the first is finished; we get the
# expected <tt>person.visits == 4</tt>.
#
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/result.rb
@@ -1,7 +1,7 @@
module ActiveRecord
###
# This class encapsulates a Result returned from calling +exec_query+ on any
# database connection adapter. For example:
# database connection adapter. For example:
#
# x = ActiveRecord::Base.connection.exec_query('SELECT * FROM foo')
# x # => #<ActiveRecord::Result:0xdeadbeef>
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/schema_dumper.rb
Expand Up @@ -106,7 +106,7 @@ def table(table, stream)
spec = {}
spec[:name] = column.name.inspect

# AR has an optimisation which handles zero-scale decimals as integers. This
# AR has an optimisation which handles zero-scale decimals as integers. This
# code ensures that the dumper still dumps the column as a decimal.
spec[:type] = if column.type == :integer && [/^numeric/, /^decimal/].any? { |e| e.match(column.sql_type) }
'decimal'
Expand Down
Expand Up @@ -75,7 +75,7 @@ module Serialization
# </firm>
#
# Additionally, the record being serialized will be passed to a Proc's second
# parameter. This allows for ad hoc additions to the resultant document that
# parameter. This allows for ad hoc additions to the resultant document that
# incorporate the context of the record being serialized. And by leveraging the
# closure created by a Proc, to_xml can be used to add elements that normally fall
# outside of the scope of the model -- for example, generating and appending URLs
Expand Down
18 changes: 9 additions & 9 deletions activerecord/lib/active_record/session_store.rb
@@ -1,7 +1,7 @@
module ActiveRecord
# = Active Record Session Store
#
# A session store backed by an Active Record class. A default class is
# A session store backed by an Active Record class. A default class is
# provided, but any object duck-typing to an Active Record Session class
# with text +session_id+ and +data+ attributes is sufficient.
#
Expand All @@ -23,7 +23,7 @@ module ActiveRecord
# ActiveRecord::SessionStore::Session.data_column_name = 'legacy_session_data'
#
# Note that setting the primary key to the +session_id+ frees you from
# having a separate +id+ column if you don't want it. However, you must
# having a separate +id+ column if you don't want it. However, you must
# set <tt>session.model.id = session.session_id</tt> by hand! A before filter
# on ApplicationController is a good place.
#
Expand All @@ -46,7 +46,7 @@ module ActiveRecord
# save
# destroy
#
# The example SqlBypass class is a generic SQL session store. You may
# The example SqlBypass class is a generic SQL session store. You may
# use it as a basis for high-performance database-specific stores.
class SessionStore < ActionDispatch::Session::AbstractStore
module ClassMethods # :nodoc:
Expand Down Expand Up @@ -79,7 +79,7 @@ class Session < ActiveRecord::Base

##
# :singleton-method:
# Customizable data column name. Defaults to 'data'.
# Customizable data column name. Defaults to 'data'.
cattr_accessor :data_column_name
self.data_column_name = 'data'

Expand Down Expand Up @@ -161,12 +161,12 @@ def raise_on_session_data_overflow!
end

# A barebones session store which duck-types with the default session
# store but bypasses Active Record and issues SQL directly. This is
# store but bypasses Active Record and issues SQL directly. This is
# an example session model class meant as a basis for your own classes.
#
# The database connection, table name, and session id and data columns
# are configurable class attributes. Marshaling and unmarshaling
# are implemented as class methods that you may override. By default,
# are configurable class attributes. Marshaling and unmarshaling
# are implemented as class methods that you may override. By default,
# marshaling data is
#
# ActiveSupport::Base64.encode64(Marshal.dump(data))
Expand All @@ -176,7 +176,7 @@ def raise_on_session_data_overflow!
# Marshal.load(ActiveSupport::Base64.decode64(data))
#
# This marshaling behavior is intended to store the widest range of
# binary session data in a +text+ column. For higher performance,
# binary session data in a +text+ column. For higher performance,
# store in a +blob+ column instead and forgo the Base64 encoding.
class SqlBypass
extend ClassMethods
Expand Down Expand Up @@ -286,7 +286,7 @@ def destroy
end
end

# The class used for session storage. Defaults to
# The class used for session storage. Defaults to
# ActiveRecord::SessionStore::Session
cattr_accessor :session_class
self.session_class = Session
Expand Down

0 comments on commit 0034b78

Please sign in to comment.