Best way to export a database table to a YAML file?

后端 未结 11 1265
野的像风
野的像风 2020-12-07 14:54

I have some data in my development database that I would like to utilize as fixtures in my test environment. What is the best way in Rails 2.x to export a database table to

11条回答
  •  自闭症患者
    2020-12-07 15:44

    There is a rake task for this. You can specify RAILS_ENV if needed; the default is the development environment:

    rake db:fixtures:dump
        # Create YAML test fixtures from data in an existing database.
    

提交回复
热议问题