seeds.rb 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # This file should contain all the record creation needed to seed the database with its default values.
  2. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
  3. #
  4. # Examples:
  5. #
  6. # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
  7. # Mayor.create(:name => 'Emanuel', :city => cities.first)
  8. # clear old caches to start from scratch
  9. Cache.clear
  10. # this is the __ordered__ list of seed files
  11. # extend only if needed - try to add your changes
  12. # to the matching one of the existing files
  13. 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]
  14. # loop and require all seedfiles
  15. # files will get executed automatically
  16. seeds.each do |seed|
  17. # we use require relative here since
  18. # - we the seeds file to get loaded only once
  19. # - we want to require it relative to the current path
  20. require_relative "seeds/#{seed}.rb"
  21. end
  22. # reset primary key sequences
  23. DbHelper.import_post
  24. # install locales and translations
  25. Locale.create_if_not_exists(
  26. locale: 'en-us',
  27. alias: 'en',
  28. name: 'English (United States)',
  29. )
  30. Locale.sync
  31. Translation.sync
  32. Calendar.init_setup
  33. # install all packages in auto_install
  34. Package.auto_install