1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make the method signature of association.build the same as klass.build and relation.build

This commit is contained in:
Ryuta Kamizono 2019-10-20 02:51:59 +09:00
parent 7f6d2914c6
commit 01336b71af
3 changed files with 4 additions and 4 deletions

View file

@ -192,11 +192,11 @@ module ActiveRecord
set_inverse_instance(record)
end
def create(attributes = {}, &block)
def create(attributes = nil, &block)
_create_record(attributes, &block)
end
def create!(attributes = {}, &block)
def create!(attributes = nil, &block)
_create_record(attributes, true, &block)
end

View file

@ -101,7 +101,7 @@ module ActiveRecord
end
end
def build(attributes = {}, &block)
def build(attributes = nil, &block)
if attributes.is_a?(Array)
attributes.collect { |attr| build(attr, &block) }
else

View file

@ -17,7 +17,7 @@ module ActiveRecord
replace(record)
end
def build(attributes = {}, &block)
def build(attributes = nil, &block)
record = build_record(attributes, &block)
set_new_record(record)
record