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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -