Load and use fixture in rails console

前端 未结 6 1826
南方客
南方客 2021-01-31 08:07

I wonder if there\'s a way to load and/or use fixture in rails console. Actually, I\'d like to create a user from my fixture users.yml to do some testing without ha

6条回答
  •  庸人自扰
    2021-01-31 09:00

    May be late... Rails 4

    require 'active_record/fixtures'
    ActiveRecord::FixtureSet.create_fixtures(Rails.root.join('test', 'fixtures'), 'users')
    

提交回复
热议问题