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

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -