Mailboxer validation

103 views Asked by At

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?

1

There are 1 answers

0
MZaragoza On

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