I have a couple models which are associated with the has_many
belongs_to
pair. For the sake of demonstration, a client has one server but a server has many clients. I might do something like this:
client1.server = the_server
client2.server = the_server
client3.server = the_server
My actual application is quite a bit more complex than this, but the example will work for illustration.
I want to inspect the associations between these objects before I save them. ActiveRecord doesn't update their information until they are saved though. In the example above, the_server
has no idea who client1
, client2
, or client3
are until one of them gets saved. I'm sure that this helps active_record's efficiency, but it leaves model instances in memory in an inconsistent state.
Is there anything I can call on the clients or on the server that will cause them to update their states?