diff options
author | Xavier Noria <fxn@hashref.com> | 2011-06-06 22:23:30 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-06-06 22:23:30 +0200 |
commit | 5e21247131fa7d5484190c9a71b74f9d3f090684 (patch) | |
tree | 5eee39fcabb952cafd513caf7e67943bc6b26e98 /activerecord | |
parent | 38ad6bb2f566202dd522a0cf31a55a746f122d53 (diff) | |
parent | 689e12b828665b7b2cfcda85d46249c5cf2aa713 (diff) | |
download | rails-5e21247131fa7d5484190c9a71b74f9d3f090684.tar.gz rails-5e21247131fa7d5484190c9a71b74f9d3f090684.tar.bz2 rails-5e21247131fa7d5484190c9a71b74f9d3f090684.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Conflicts:
activerecord/RUNNING_UNIT_TESTS
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 1 | ||||
-rw-r--r-- | activerecord/README.rdoc | 18 | ||||
-rw-r--r-- | activerecord/RUNNING_UNIT_TESTS | 9 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/primary_key.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/migration/command_recorder.rb | 12 | ||||
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 2 |
8 files changed, 30 insertions, 24 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index b05d3970c7..ead2a244e5 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -240,7 +240,6 @@ def up create_table :posts do |t| t.belongs_to :user - t.timestamps end diff --git a/activerecord/README.rdoc b/activerecord/README.rdoc index 0d00749901..822276589b 100644 --- a/activerecord/README.rdoc +++ b/activerecord/README.rdoc @@ -3,7 +3,7 @@ Active Record connects classes to relational database tables to establish an almost zero-configuration persistence layer for applications. The library provides a base class that, when subclassed, sets up a mapping between the new -class and an existing table in the database. In context of an application, +class and an existing table in the database. In the context of an application, these classes are commonly referred to as *models*. Models can also be connected to other models; this is done by defining *associations*. @@ -70,7 +70,7 @@ A short rundown of some of the major features: {Learn more}[link:classes/ActiveRecord/Validations.html] -* Callbacks available for the entire life cycle (instantiation, saving, destroying, validating, etc.) +* Callbacks available for the entire life cycle (instantiation, saving, destroying, validating, etc.). class Person < ActiveRecord::Base before_destroy :invalidate_payment_plan @@ -80,7 +80,7 @@ A short rundown of some of the major features: {Learn more}[link:classes/ActiveRecord/Callbacks.html] -* Observers that react to changes in a model +* Observers that react to changes in a model. class CommentObserver < ActiveRecord::Observer def after_create(comment) # is called just after Comment#save @@ -91,7 +91,7 @@ A short rundown of some of the major features: {Learn more}[link:classes/ActiveRecord/Observer.html] -* Inheritance hierarchies +* Inheritance hierarchies. class Company < ActiveRecord::Base; end class Firm < Company; end @@ -101,7 +101,7 @@ A short rundown of some of the major features: {Learn more}[link:classes/ActiveRecord/Base.html] -* Transactions +* Transactions. # Database transaction Account.transaction do @@ -112,7 +112,7 @@ A short rundown of some of the major features: {Learn more}[link:classes/ActiveRecord/Transactions/ClassMethods.html] -* Reflections on columns, associations, and aggregations +* Reflections on columns, associations, and aggregations. reflection = Firm.reflect_on_association(:clients) reflection.klass # => Client (class) @@ -121,7 +121,7 @@ A short rundown of some of the major features: {Learn more}[link:classes/ActiveRecord/Reflection/ClassMethods.html] -* Database abstraction through simple adapters +* Database abstraction through simple adapters. # connect to SQLite3 ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => "dbfile.sqlite3") @@ -141,13 +141,13 @@ A short rundown of some of the major features: SQLite3[link:classes/ActiveRecord/ConnectionAdapters/SQLite3Adapter.html]. -* Logging support for Log4r[http://log4r.sourceforge.net] and Logger[http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc] +* Logging support for Log4r[http://log4r.sourceforge.net] and Logger[http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc]. ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Base.logger = Log4r::Logger.new("Application Log") -* Database agnostic schema management with Migrations +* Database agnostic schema management with Migrations. class AddSystemSettings < ActiveRecord::Migration def self.up diff --git a/activerecord/RUNNING_UNIT_TESTS b/activerecord/RUNNING_UNIT_TESTS index bc4faa488c..16444249cc 100644 --- a/activerecord/RUNNING_UNIT_TESTS +++ b/activerecord/RUNNING_UNIT_TESTS @@ -22,4 +22,11 @@ environment variable: You can run all the tests for a given database via rake: - $ rake test_postgresql +To setup the testing environment for PostgreSQL use this command: + + rake postgresql:build_databases + +The incantation for running a particular test looks like this + + rake test TEST=test/cases/datatype_test_postgresql.rb TESTOPTS="--name=test_timestamp_with_zone_values_without_rails_time_zone_support" + diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 3acfa5f729..2cbfa42718 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -452,12 +452,12 @@ module ActiveRecord # end # # Some extensions can only be made to work with knowledge of the association's internals. - # Extensions can access relevant state using the following methods (where 'items' is the + # Extensions can access relevant state using the following methods (where +items+ is the # name of the association): # - # * +record.association(:items).owner+ - Returns the object the association is part of. - # * +record.association(:items).reflection+ - Returns the reflection object that describes the association. - # * +record.association(:items).target+ - Returns the associated object for +belongs_to+ and +has_one+, or + # * <tt>record.association(:items).owner</tt> - Returns the object the association is part of. + # * <tt>record.association(:items).reflection</tt> - Returns the reflection object that describes the association. + # * <tt>record.association(:items).target</tt> - Returns the associated object for +belongs_to+ and +has_one+, or # the collection of associated objects for +has_many+ and +has_and_belongs_to_many+. # # === Association Join Models diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb index 5f06452247..e3f221c773 100644 --- a/activerecord/lib/active_record/attribute_methods/primary_key.rb +++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb @@ -48,7 +48,7 @@ module ActiveRecord end attr_accessor :original_primary_key - + # Attribute writer for the primary key column def primary_key=(value) @quoted_primary_key = nil diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 640111096d..de26b21f1a 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -53,7 +53,7 @@ module ActiveRecord # # This migration will add a boolean flag to the accounts table and remove it # if you're backing out of the migration. It shows how all migrations have - # two class methods +up+ and +down+ that describes the transformations + # two methods +up+ and +down+ that describes the transformations # required to implement or remove the migration. These methods can consist # of both the migration specific methods like add_column and remove_column, # but may also contain regular Ruby code for generating data needed for the diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb index ed8e5ae140..f01e94169f 100644 --- a/activerecord/lib/active_record/migration/command_recorder.rb +++ b/activerecord/lib/active_record/migration/command_recorder.rb @@ -1,6 +1,6 @@ module ActiveRecord class Migration - # ActiveRecord::Migration::CommandRecorder records commands done during + # <tt>ActiveRecord::Migration::CommandRecorder</tt> records commands done during # a migration and knows how to reverse those commands. The CommandRecorder # knows how to invert the following commands: # @@ -23,7 +23,7 @@ module ActiveRecord # record +command+. +command+ should be a method name and arguments. # For example: # - # recorder.record(:method_name, [:arg1, arg2]) + # recorder.record(:method_name, [:arg1, :arg2]) def record(*command) @commands << command end @@ -34,7 +34,7 @@ module ActiveRecord # recorder.record(:rename_table, [:old, :new]) # recorder.inverse # => [:rename_table, [:new, :old]] # - # This method will raise an IrreversibleMigration exception if it cannot + # This method will raise an +IrreversibleMigration+ exception if it cannot # invert the +commands+. def inverse @commands.reverse.map { |name, args| @@ -50,9 +50,9 @@ module ActiveRecord [:create_table, :rename_table, :add_column, :remove_column, :rename_index, :rename_column, :add_index, :remove_index, :add_timestamps, :remove_timestamps, :change_column, :change_column_default].each do |method| class_eval <<-EOV, __FILE__, __LINE__ + 1 - def #{method}(*args) - record(:"#{method}", args) - end + def #{method}(*args) # def create_table(*args) + record(:"#{method}", args) # record(:create_table, args) + end # end EOV end diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index d363f36108..ae97a3f3ca 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -165,7 +165,7 @@ module ActiveRecord # writing, the only database that we're aware of that supports true nested # transactions, is MS-SQL. Because of this, Active Record emulates nested # transactions by using savepoints on MySQL and PostgreSQL. See - # http://dev.mysql.com/doc/refman/5.0/en/savepoints.html + # http://dev.mysql.com/doc/refman/5.0/en/savepoint.html # for more information about savepoints. # # === Callbacks |