According to my knowledge build
is doing exactly what new
does, additionally it updates the Collection with which new Model is associated. So after using build
to create new user shout, you could save new shout in persistence layer by calling save
method on user
:
shout = user.shouts.build(shout_parameters)
# now user.shouts contain new shout
# and you can run .save method on either user or shout
shout.save
# or
user.save
while with new
you cannot save new shout
in persistence layer by saving user
. You have to call save
method on new Shout
instance:
shout = user.shouts.new(shout_parameters)
shout.save
Hope that makes sense