Sha256: ffe60b42b8dccfd4f35c678d3aa1b231ac5626df9d4e524d0933695b77318226

Contents?: true

Size: 439 Bytes

Versions: 77

Compression:

Stored size: 439 Bytes

Contents

module WithMessages
  def receive_answer!(answer)
    build_message(answer).save!
  end

  def send_question!(question)
    message = build_message question.merge(sender: submitter.uid, read: true)
    message.save_and_notify!
  end

  def build_message(body)
    messages.build({date: DateTime.current}.merge(body))
  end

  def has_messages?
    messages.exists?
  end

  def pending_messages?
    messages.exists? read: false
  end
end

Version data entries

77 entries across 77 versions & 2 rubygems

Version Path
mumuki-domain-9.8.1 app/models/concerns/with_messages.rb
mumuki-domain-9.8.0 app/models/concerns/with_messages.rb
mumuki-domain-9.7.0 app/models/concerns/with_messages.rb
mumuki-domain-9.6.0 app/models/concerns/with_messages.rb
mumuki-domain-9.5.0 app/models/concerns/with_messages.rb
mumuki-domain-9.4.0 app/models/concerns/with_messages.rb
mumuki-domain-9.3.0 app/models/concerns/with_messages.rb
mumuki-domain-9.2.1 app/models/concerns/with_messages.rb
mumuki-domain-9.2.0 app/models/concerns/with_messages.rb
mumuki-domain-9.1.2 app/models/concerns/with_messages.rb
mumuki-domain-9.1.1 app/models/concerns/with_messages.rb
mumuki-domain-9.1.0 app/models/concerns/with_messages.rb
mumuki-domain-9.0.6 app/models/concerns/with_messages.rb
mumuki-domain-9.0.5 app/models/concerns/with_messages.rb
mumuki-domain-9.0.4 app/models/concerns/with_messages.rb
mumuki-domain-9.0.3 app/models/concerns/with_messages.rb
mumuki-domain-9.0.2 app/models/concerns/with_messages.rb
mumuki-domain-9.0.0 app/models/concerns/with_messages.rb
mumuki-domain-8.6.1 app/models/concerns/with_messages.rb
mumuki-domain-8.6.0 app/models/concerns/with_messages.rb