title: In Rails-4.2 when during initialisation do the methods 'create' and 'update' get added to AR::Base?
body: <p>The problem:  We have a number of custom columns used for auditing purposes.  They are functionally similar to Rails timestamps but containing different data.  We previously implemented an initializer that uses alias_method_chain to intercept the create and update methods of AR::Base, perform the necessary checking for, and populate any found audit columns immediately before inserting or updating rows.</p>
  
  <p>However, as of Rails-4 the create and update methods do not exist in AR::Base at the time our initializer is loaded.  So this approach fails. </p>
  
  <p>To use the existing technique I need to discover exactly when these two methods are added to AR::Base and how to include our interception module sometime thereafter.  However, I am not wedded to the solution in place and would willing implement a better approach if one is available.</p>
  
  <p>Ideally, I would just like to do something where the actual method code approximates the following:</p>
  
  <pre><code>module HLLAuditStamps
  
    def create
      set_audit_attributes
      super
    end
  
    def update
      set_audit_attributes
      super
    end
  
  private
    def set_audit_attributes
      . . .
    end
  end  
  
  class AR::Base
    include HLLAuditStamps
  end
  </code></pre>
  
  <p>Can this, or something having the same effect, be done?  What we are trying to avoid is the necessity of adding the code to handle this to each and every model.</p>
  
  <p>I ended up using as a template for my answer the question asked at: <a href="https://stackoverflow.com/questions/28044265/extending-activerecordbase-not-working/28073362#28073362">Extending ActiveRecord::Base not working</a>.  Which is in most respects the same as that proposed below.</p>