diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-11-20 15:30:46 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-11-20 15:30:46 +0100 |
commit | d56be864f61cc00eeff27ed42e7cec4194c5347f (patch) | |
tree | 82ee21eb30e8de1dc9b7cfc329b6ea5ed34676ea /activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | |
parent | 7839e27b4e467b5cf94e83555b9b6f0a4f6aaf8a (diff) | |
download | rails-d56be864f61cc00eeff27ed42e7cec4194c5347f.tar.gz rails-d56be864f61cc00eeff27ed42e7cec4194c5347f.tar.bz2 rails-d56be864f61cc00eeff27ed42e7cec4194c5347f.zip |
synchronize code and docs for `timestamps` and `add_timestamps`.
This makes the following changes:
* warn if `:null` is not passed to `add_timestamps`
* `timestamps` method docs link to `add_timestamps` docs
* explain where additional options go
* adjust examples to include `null: false` (to prevent deprecation warnings)
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index cc86c3776e..7cc5e666af 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -835,11 +835,14 @@ module ActiveRecord columns end - # Adds timestamps (+created_at+ and +updated_at+) columns to the named table. + include TimestampDefaultDeprecation + # Adds timestamps (+created_at+ and +updated_at+) columns to +table_name+. + # Additional options (like <tt>null: false</tt>) are forwarded to #add_column. # - # add_timestamps(:suppliers) + # add_timestamps(:suppliers, null: false) # def add_timestamps(table_name, options = {}) + emit_warning_if_null_unspecified(options) add_column table_name, :created_at, :datetime, options add_column table_name, :updated_at, :datetime, options end |