title: Load an ActiveRecord models from a YAML file
body: <p><br>
  I'd like to create an ActiveRecord readonly model that is populated from a <strong>YAML</strong> file.
  Here is my model:</p>
  
  <pre><code>class Building  &lt; ActiveRecord::Base
  
  ?right_callback_to_use? :load_data_from_yaml
  after_initialize :readonly!
  
  def load_data_from_yaml
      #implementation?
  end
  
  end
  </code></pre>
  
  <p>And here is my yml</p>
  
  <pre><code>- id: 1
    name: Building 1
  - id: 2
    name: Building 2
  </code></pre>
  
  <p>How can I load data from my external yml file and associate them with my model?</p>
  
  <p>And how should I call my function <code>load_data_from_yaml</code> only once and only at the very beginning of my application?</p>
  
  <p>I'm using <strong>Rails 4</strong>.</p>
  
  <p>Thank you!</p>