'Why it runs twice when seed in rails?
I just put puts "test"
in the seeds file , when I run rake db:seed
, I saw there are 2 lines "test"
Solution 1:[1]
I'm experiencing this when I load tasks in my Rails code, for example
# config/initializers/rake_load_tasks.rb
# DO NOT USE THIS, IT WILL CAUSE rails db:seed TO RUN TWICE
require "rake"
Rails.application.load_tasks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | duleorlovic |