seeds.rb 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. # inital data set as extention to db/seeds.rb
  2. Trigger.destroy_all
  3. Job.destroy_all
  4. # create email address and apply it to all groups
  5. channel_id = nil
  6. channel = Channel.find_by(area: 'Email::Notification', active: true)
  7. if channel
  8. channel_id = channel.id
  9. end
  10. email_address = EmailAddress.create_or_update(
  11. realname: 'Zammad',
  12. email: 'zammad@localhost',
  13. channel_id: channel_id,
  14. updated_by_id: 1,
  15. created_by_id: 1
  16. )
  17. Group.all.each do |group|
  18. group.email_address_id = email_address.id
  19. group.save!
  20. end
  21. User.create_or_update(
  22. login: 'admin@example.com',
  23. firstname: 'Default',
  24. lastname: 'Admin',
  25. email: 'admin@example.com',
  26. password: 'adminpw',
  27. active: true,
  28. roles: Role.where(name: %w[Admin]),
  29. updated_by_id: 1,
  30. created_by_id: 1,
  31. )