diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2016-08-14 05:05:34 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2016-08-14 05:05:34 +0900 |
commit | e7023cb8f153a1b340c24c9b2525e8b27567ebdb (patch) | |
tree | a6f6339e02d65fc38ae68604a18760560e689dcd /activerecord/lib/active_record | |
parent | 6107a40c0e4d05614493bddf33d5ae8d9ce8a8d2 (diff) | |
download | rails-e7023cb8f153a1b340c24c9b2525e8b27567ebdb.tar.gz rails-e7023cb8f153a1b340c24c9b2525e8b27567ebdb.tar.bz2 rails-e7023cb8f153a1b340c24c9b2525e8b27567ebdb.zip |
Avoid to allow unused splat args for `t.timestamps` in `create_table`
Unfortunately `t.timestamps` in `create_table` allows unused splat args.
But the same one in `change_table` does not allow them.
This commit fixes the inconsistent behavior.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/migration/compatibility.rb | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index c10f45937e..0adcef619b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -341,9 +341,7 @@ module ActiveRecord # <tt>:updated_at</tt> to the table. See {connection.add_timestamps}[rdoc-ref:SchemaStatements#add_timestamps] # # t.timestamps null: false - def timestamps(*args) - options = args.extract_options! - + def timestamps(**options) options[:null] = false if options[:null].nil? column(:created_at, :datetime, options) diff --git a/activerecord/lib/active_record/migration/compatibility.rb b/activerecord/lib/active_record/migration/compatibility.rb index a79251f908..04e538baa5 100644 --- a/activerecord/lib/active_record/migration/compatibility.rb +++ b/activerecord/lib/active_record/migration/compatibility.rb @@ -21,7 +21,7 @@ module ActiveRecord end alias :belongs_to :references - def timestamps(*, **options) + def timestamps(**options) options[:null] = true if options[:null].nil? super end @@ -59,7 +59,7 @@ module ActiveRecord end alias :add_belongs_to :add_reference - def add_timestamps(*, **options) + def add_timestamps(_, **options) options[:null] = true if options[:null].nil? super end |