Guest User

Untitled

a guest
Feb 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class Comatose::Page < ActiveRecord::Base
  2. end
  3.  
  4. desc "load pages"
  5. task :load_pages_to_db => :environment do
  6.  
  7. YAML::add_private_type("Comatose::Page") do |type, value|
  8. Comatose::Page.new(value)
  9. end
  10.  
  11. dump_yaml = 'comatose_dump.yaml'
  12. @pages = YAML::load_file( dump_yaml )
  13. @pages.each do |p|
  14. Comatose::Page.create(p.attributes)
  15. end
  16.  
  17. end
Add Comment
Please, Sign In to add comment