title: What methods are used to set attributes when data is pulled from a table in Ruby ActiveRecord?
body: <p>I'm using ActiveRecord 4.1.8 in a Ruby (not Rails) application. I have a table and a corresponding model that looks like the following:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>create_table 'people', :force =&gt; true do |t|
    t.string 'name'
  end
  
  class Person &lt; ActiveRecord::Base
    def name=(name)
      puts "Attribute setter for name called with #{name}"
      write_attribute(:name, name)
    end
  end
  </code></pre>
  
  <p>When I create a new instance of Person, I see the <code>Attribute setter for name called with...</code> written to STDOUT. However, when I reload the model instance, I do not see the message written to STDOUT.</p>
  
  <pre class="lang-ruby prettyprint-override"><code>p = Person.create(name: 'foobar')
  --&gt; Attribute setter for name called with foobar
  
  p.reload
  --&gt; &lt;nothing&gt;
  </code></pre>
  
  <p>The model is getting persisted to the database, so this makes me think <code>name=</code> isn't used when data is loaded into a model from the database. I need to modify certain data attributes when they're read in from the database, so does anyone know what other method I need to override?</p>