提交 1a52ed17 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #26151 from kamipo/avoid_to_allow_unused_splat_args

Avoid to allow unused splat args for `t.timestamps` in `create_table`
......@@ -341,9 +341,7 @@ def foreign_key(table_name, options = {}) # :nodoc:
# <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)
......
......@@ -21,7 +21,7 @@ def references(*, **options)
end
alias :belongs_to :references
def timestamps(*, **options)
def timestamps(**options)
options[:null] = true if options[:null].nil?
super
end
......@@ -59,7 +59,7 @@ def add_reference(*, **options)
end
alias :add_belongs_to :add_reference
def add_timestamps(*, **options)
def add_timestamps(_, **options)
options[:null] = true if options[:null].nil?
super
end
......
......@@ -462,7 +462,7 @@ def test_all_timestamp_attributes_in_model
def test_index_is_created_for_both_timestamps
ActiveRecord::Base.connection.create_table(:foos, force: true) do |t|
t.timestamps(:foos, null: true, index: true)
t.timestamps null: true, index: true
end
indexes = ActiveRecord::Base.connection.indexes("foos")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册