20100301000021_load_user_data.rb 672 B

12345678910111213141516171819202122
  1. #---
  2. # Excerpted from "Agile Web Development with Rails",
  3. # published by The Pragmatic Bookshelf.
  4. # Copyrights apply to this code. It may not be used to create training material,
  5. # courses, books, articles, and the like. Contact us if you are in doubt.
  6. # We make no guarantees that this code is fit for any purpose.
  7. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  8. #---
  9. require 'active_record/fixtures'
  10. class LoadUserData < ActiveRecord::Migration
  11. def self.up
  12. down
  13. directory = File.join(File.dirname(__FILE__), 'dev_data')
  14. Fixtures.create_fixtures(directory, "users")
  15. end
  16. def self.down
  17. User.delete_all
  18. end
  19. end