title: Rails variable returns two different values?
body: <p>For some weird reason an instance variable I have puts out two different values on two different occasions. </p>
  
  <pre><code>$ puts @project.to_yaml
  </code></pre>
  
  <p>gives:</p>
  
  <pre><code>  id: 3
    title: '123'
    created_at: 2014-04-07 23:54:18.253262000 Z
    updated_at: 2014-04-09 09:20:33.847246000 Z
    amount_donated: 50000
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$ @project.amount_donated
  </code></pre>
  
  <p>gives:</p>
  
  <pre><code>  nil
  </code></pre>
  
  <p>Explain this one to me because I'm terribly lost.</p>
  
  <p><strong>EDIT</strong>
  Project model</p>
  
  <pre><code>class Project &lt; ActiveRecord::Base
    require 'date'
  
    attr_accessor(:amount_donated)
    before_save :convert_params
  
    def convert_params
      if amount_donated.present?
        value = amount_donated.to_s.split(',').join
        value = value.to_f * 100
        update_column(:amount_donated, value.to_i)
      end
    end
  end
  </code></pre>