title: Can not instantiate a model's attribute based upon another attribute
body: <p>In Rails, I have a model <code>M</code> with two fields: <code>a1</code> and <code>a2</code>.</p>
  
  <p>When creating a new <code>M</code>, I am passing a value for <code>a1</code> from the view.</p>
  
  <p>In the model, I want to generate a value for <code>a2</code> based upon the value of <code>a1</code>, as shown underneath:</p>
  
  <pre><code>class M &lt; ActiveRecord::Base
        after_save :derive_a2
  
      private
  
        def derive_a2
          @a2 = Nokogiri::HTML(open(@a1).read)
        end
  
      end
  </code></pre>
  
  <p>On the line <code>@a2 = Nokogiri::HTML(open(@a1).read)</code> I get an error stating that <code>@a1</code> is null. However, this should not be the case as I am passing the attribute <code>a1</code> from the view. </p>
  
  <p>The method <code>derive_a2</code> is executed using the <code>after_save</code> lifecycle method so it should access the record after it has been saved.</p>
  
  <p>Why does the field <code>a1</code> appear as null?</p>