Fixed bug: Re-seed-ing not possible in same process because require_relative loads file only once.
This commit is contained in:
parent
8d078e7398
commit
83ed53d245
1 changed files with 3 additions and 5 deletions
|
@ -14,13 +14,11 @@ Cache.clear
|
||||||
# to the matching one of the existing files
|
# to the matching one of the existing files
|
||||||
seeds = %w[settings user_nr_1 signatures roles permissions groups links ticket_state_types ticket_states ticket_priorities ticket_article_types ticket_article_senders macros community_user_resources overviews channels report_profiles chats object_manager_attributes schedulers triggers karma_activities]
|
seeds = %w[settings user_nr_1 signatures roles permissions groups links ticket_state_types ticket_states ticket_priorities ticket_article_types ticket_article_senders macros community_user_resources overviews channels report_profiles chats object_manager_attributes schedulers triggers karma_activities]
|
||||||
|
|
||||||
# loop and require all seedfiles
|
# loop over and load all seedfiles
|
||||||
# files will get executed automatically
|
# files will get executed automatically
|
||||||
seeds.each do |seed|
|
seeds.each do |seed|
|
||||||
# we use require relative here since
|
# we use load here to be able to re-seed in one process (test env)
|
||||||
# - we the seeds file to get loaded only once
|
load Rails.root.join('db', 'seeds', "#{seed}.rb")
|
||||||
# - we want to require it relative to the current path
|
|
||||||
require_relative "seeds/#{seed}.rb"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# reset primary key sequences
|
# reset primary key sequences
|
||||||
|
|
Loading…
Reference in a new issue