title: How to provide parameters when initializing a ActiveRecord model in Rails
body: <p>I have read allot of questions on here about different ways to initialize a ActiveRecord model properly when dealing with initializing values and is always in relation to providing default values. A great <a href="https://stackoverflow.com/questions/328525/what-is-the-best-way-to-set-default-values-in-activerecord">answer</a> I came across helped clarify different ways.</p>
  
  <p>However, if it is frowned upon to override the ActiveRecord base initialize method, what is the proper way to provide parameters to an ActiveRecord model when you want to initialize with values as you would in a standard Ruby class <code>initialize(arg1, arg2...)</code> method.</p>
  
  <p>so you can </p>
  
  <pre><code>obj = MyObject.new(Obj1, some_num)
  </code></pre>
  
  <p>The only thing I have come across was actually overrideing the <code>initialize</code> method but calling <code>super</code> first in the initialize.  However, this was frowned on because ActiveRecord's base class uses <code>allocate</code> in allot of cases to instantiate an AR object and therefore could end up sidestepping the entire initialize method.</p>
  
  <p>So, maybe there is another fundamental reason why I am not finding providing initial values as a standard practice in RoR?</p>
  
  <p>I know I can use validates in the object to validate an object can't be saved without meeting requirements, such as having all the proper attributes set.  But I was approaching this particular object, so that it wouldn't be created without the required attributes when it is initialized to begin (since at initialization we would have all that information and if retrieving from the DB we would have all those values).</p>
  
  <p>Can someone help direct me?</p>
  
  <p><strong>extra question</strong>
  If there is an accepted way to do the above, there seems to be another area that needs to be considered when initializing objects with values and that is when the object is initialized from being retrieved from the DB.  Not handling the initializing values properly can possibly override what is retrieved from the DB (or I have read when related to setting attributes to default values).  So if that needs to be handled properly, how do we do that?</p>