article.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
  2. class Ticket::Article < ApplicationModel
  3. load 'ticket/article/assets.rb'
  4. include Ticket::Article::Assets
  5. load 'ticket/article/history_log.rb'
  6. include Ticket::Article::HistoryLog
  7. load 'ticket/article/activity_stream_log.rb'
  8. include Ticket::Article::ActivityStreamLog
  9. belongs_to :ticket
  10. belongs_to :type, :class_name => 'Ticket::Article::Type'
  11. belongs_to :sender, :class_name => 'Ticket::Article::Sender'
  12. belongs_to :created_by, :class_name => 'User'
  13. after_create :notify_clients_after_create
  14. after_update :notify_clients_after_update
  15. after_destroy :notify_clients_after_destroy
  16. activity_stream_support :ignore_attributes => {
  17. :type_id => true,
  18. :sender_id => true,
  19. }
  20. history_support :ignore_attributes => {
  21. :type_id => true,
  22. :sender_id => true,
  23. }
  24. class Flag < ApplicationModel
  25. end
  26. class Sender < ApplicationModel
  27. validates :name, :presence => true
  28. end
  29. class Type < ApplicationModel
  30. validates :name, :presence => true
  31. end
  32. end