ruby on rails - add a record to has_many model without saving -
ruby on rails - add a record to has_many model without saving -
a client has many orders. customer.orders gives me orders.
i want add together order orders internal check. don't want order added info base.
but when doing:
customer.orders << test_order
it beingness saved , committed info base.
so how can add together utilize without saving?
you can utilize build, initialize order object without saving it.
test_order = customer.orders.build(order_params)
ruby-on-rails
Comments
Post a Comment