Class: Inferno::Repositories::Messages::Model
- Inherits:
-
Object
- Object
- Inferno::Repositories::Messages::Model
- Defined in:
- lib/inferno/repositories/messages.rb
Instance Method Summary collapse
Instance Method Details
#before_create ⇒ Object
17 18 19 20 |
# File 'lib/inferno/repositories/messages.rb', line 17 def before_create self.id = SecureRandom.uuid super end |
#validate ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/inferno/repositories/messages.rb', line 22 def validate super types = Entities::Message::TYPES errors.add(:message, 'must be present') if .blank? errors.add(:type, 'must be present') if type.blank? errors.add(:type, "'#{type}' is invalid. Must be one of: #{types.join(', ')}") unless types.include?(type) end |