title: before_create in rails model
body: <p>I have a rails model <code>User</code> that has <code>name</code>, <code>email</code> and <code>hash</code> fields.  </p>
  
  <p>I save data to this by doing:</p>
  
  <pre><code>@u = User.create(:name=&gt;'test', :email=&gt;"test@mail.com")
  @u.save
  </code></pre>
  
  <p>How can I incorporate the <code>before_create</code> callback so that before saving the record the hash value gets a hash string by following code:</p>
  
  <pre><code>Digest::SHA1.hexdigest('something secret' + email)
  </code></pre>
  
  <p>How will my <code>User</code> model look like?</p>
  
  <pre><code>class Employee &lt; ActiveRecord::Base
     before_create :set_hash
  
     def set_hash 
        //what goes in here?
     end
  end
  </code></pre>