title: Rails Dependent Update On Associated Record
body: <p>Given two associated models in rails (4.0),</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
        has_one :subscription, dependent: :destroy
  end
  
  class Subscription &lt; ActiveRecord::Base
        belongs_to :user
  end
  </code></pre>
  
  <p>The above code will ensure that when an instance of <code>User</code> is destroyed, its associated record will be, too.</p>
  
  <p>So far so good.</p>
  
  <p>My question is, is it possible to equally easily invoke a dependent update as well, so that every time <code>User</code> is updated, <code>Subscription</code> will be updated as well?</p>
  
  <p>This could look like this:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
        has_one :subscription, dependent: [:update, :destroy]
  end
  </code></pre>
  
  <p>So that when <code>User</code> gets updated successfully, the associated <code>Subscription</code> will re-save, thus invoking its update filters (i.e. <code>before_save</code>, <code>before_update</code>, <code>after_save</code>, <code>after_update</code>).</p>
  
  <p>Is there an elegant way to do this? If not, what is the closest way to cleanly get to this?</p>
  
  <p>Thank you!</p>