title: Rails4: How to trigger the callback for attr_accessor while using accepts_nested_attributes_for
body: <p>Please check the pseudocode:</p>
  
  <pre><code>class Team
    has_many :users
    accepts_nested_attributes_for :users, allow_destroy: true
  end
  
  class User
    belongs_to :team
    has_many :addresses
    accepts_nested_attributes_for :addresses
    attr_accessor :dummy
  
    before_validation :generate_addresses_attributes
    def generate_addresses_attributes
      # Use the dummy value to set the addresses_attributes
    end
  end
  </code></pre>
  
  <p>Now when execute <code>team.update(users_attributes: [{"0" =&gt; { dummy: "changed!" }}])</code>(the other fields will not change except the dummy attribute), it will not trigger the #generate_addresses_attributes callback since it think there is nothing changes, no save, no callback...</p>
  
  <p>So my question is how to trigger the callback for the virtual attributes, or maybe force save for accepts_nested_attributes_for.</p>
  
  <p>Thank you!</p>