Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat changes were done in a form using accepts_nested_attributes_for
    text
    copied!<p>Regarding this article: <a href="http://archives.ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects" rel="nofollow">tracking activerecord objects</a></p> <p>I need to know what fields are changed in a big form using accepts_nested_attributes_for.</p> <p>Currently the form works well as expected. But in addition I'm doing a "log history" about user's changes.</p> <p>I have tried the hash mapping, but is really complicated to me since the models aren't small, and talking about the above article maybe exists a better way to track changes.</p> <p>My models are (in case is necessary):</p> <pre><code>class Customer &lt; ActiveRecord::Base has_many :addresses attr_accessible :nom, :prenom, :langue, :nationalite, :codeFiscal, :hidden_status, :subscribed attr_accessible :addresses_attributes, allow_destroy: true accepts_nested_attributes_for :addresses end class Address &lt; ActiveRecord::Base belongs_to :customer has_many :telephones attr_accessible :flag, :societe, :titre, :persContact, :rue, :rue1, :nopostal, :lieu, :pays attr_accessible :hidden_status attr_accessible :telephones_attributes accepts_nested_attributes_for :telephones, :reject_if =&gt; :all_blank, :allow_destroy =&gt; true end class Telephone &lt; ActiveRecord::Base belongs_to :address attr_accessible :typeNumero, :numeroTel end </code></pre> <p>(models are very normal).</p> <p>Any ideas?, and if I'm forced to map the hash, have you a little sample about how to ?</p> <p>Thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload