title: How to load the data from a .yml file to database?
body: <p>There is a table <code>questions</code>, and a data file <code>questions.yml</code>. Assume there is no 'Question' model.</p>
  
  <p>'questions.yml' has some recodes dump from the table.</p>
  
  <pre><code>---
  questions_001:
    title: ttt1
    content: ccc1
  questions_002:
    title: ttt2
    content: ccc2
  </code></pre>
  
  <p>I want to load the data from the yml file, insert them to database. But I can't use <code>rake db:fixtures:load</code>, because it will treat the content as 'erb' template, which is not want I want</p>
  
  <p>So I want to write another rake task, to load the data manually.</p>
  
  <p>I can read the records by:</p>
  
  <pre><code>File.open("#{RAILS_ROOT}/db/fixtures/#{table_name}.yml", 'r') do |file|
     YAML::load(file).each do |record|
        # how to insert the record??
     end
  end
  </code></pre>
  
  <p>But I don't know how to insert them.</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>I have tried:</p>
  
  <pre><code>Class.new(ActiveRecord::Base).create(record)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class Dummy &lt; ActiveRecord::Base {}
  Dummy.create(rcord)
  </code></pre>
  
  <p>But nothing inserted to database</p>