Activecord updates the field values of the associated tables

  question, ruby

There are tables users and orders. rails generates the associated table orders_users. Can you update the field values in the ORDERS _ UserS table with USER in users_controller.rb now? What should you do?

When associating two tables, the following methods will be generated to updateorders_usersIt is also operated by the following methods

user.orders<<(object, ...)
 user.orders.delete(object, ...)
 user.orders.destroy(object, ...)
 user.orders=objects
 user.orders_singular_ids
 user.orders_singular_ids=ids
 user.orders.clear
 user.orders.empty?
 user.orders.size
 user.orders.find(...)
 user.orders.where(...)
 user.orders.exists?  (...)
 user.orders.build(attributes = {})
 user.orders.create(attributes = {})
 user.orders.create!  (attributes = {})

http://guides.rubyonrails.org …

http://guides.ruby-china.org/ …