seeds.rb 529 B

123456789101112131415161718192021222324
  1. # encoding: utf-8
  2. # inital data set as extention to db/seeds.rb
  3. Trigger.destroy_all
  4. Job.destroy_all
  5. # create email address and apply it to all groups
  6. channel_id = nil
  7. channel = Channel.find_by(area: 'Email::Notification', active: true)
  8. if channel
  9. channel_id = channel.id
  10. end
  11. email_address = EmailAddress.create_or_update(
  12. realname: 'Zammad',
  13. email: 'zammad@localhost',
  14. channel_id: channel_id,
  15. updated_by_id: 1,
  16. created_by_id: 1
  17. )
  18. Group.all.each { |group|
  19. group.email_address_id = email_address.id
  20. group.save
  21. }