Question: Mailboxer validation

Question

Mailboxer validation

Answers 1
Added at 2016-12-26 05:12
Tags
Question

Hi where can I edit the mailboxer gem message validation settings? For example I'd like to restrict certain types of messages to be a certain length. Is there any way I can edit the inner models of the gem?

Answers to

Mailboxer validation

nr: #1 dodano: 2016-12-26 05:12

This is what I have in mind

class Chat < ActiveRecord::Base
  acts_as_messageable
  validates :message, length: { maximum: 250 }
  after_create :send_message


  private
  def send_message(to, from)
    from.send_message(to, self.message, self.subject)
  end

end
Source Show
◀ Wstecz