Added subject support to messages

This commit is contained in:
MrYummy
2017-06-13 03:48:30 +02:00
parent f00677a68b
commit 80026caebc
5 changed files with 21 additions and 6 deletions
+2 -1
View File
@@ -5,9 +5,10 @@ class Message < ActiveRecord::Base
belongs_to :user_sender, class_name: "User", foreign_key: "user_sender_id"
belongs_to :user_target, class_name: "User", foreign_key: "user_target_id"
validates_presence_of :user_sender, :user_target, :text, on: :create
validates_presence_of :user_sender, :user_target, :text, :subject
validates_length_of :text, in: 1..8000
validates_length_of :subject, in: 1..2000
def sender
@sender ||= if self.user_sender.present?