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:
parent
7f6d2914c6
commit
01336b71af
3 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue