Class: NextSgad::Message
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ApplicationRecord
- NextSgad::Message
- Defined in:
- app/models/next_sgad/message.rb
Instance Method Summary collapse
Methods inherited from ApplicationRecord
#create_number, #create_number!
Instance Method Details
#create_messages ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/next_sgad/message.rb', line 19 def return unless sent? = NextSgad::EmployeeMessage.new(message_id: id, title: title, body: body, signature: signature) if send_to_all all_employees_ids = NextSgad::Employee.ids else all_employees_ids = NextSgad::Position.where(function_id: functions.ids).map(&:efective_id) + NextSgad::Position.where(department_id: departments.ids).map(&:efective_id) + positions.map(&:efective_id) + employees.ids end all_employees_ids.each do |employee_id| = .dup .employee_id = employee_id .save end end |