Method: Rubix::Model#validate
- Defined in:
- lib/rubix/models/model.rb
#validate ⇒ true, false
Validate this record.
Override this method in a subclass and have it raise a Rubix::ValidationError if validation fails.
131 132 133 134 135 136 |
# File 'lib/rubix/models/model.rb', line 131 def validate self.class.properties.each_pair do |property, | raise ValidationError.new("A #{self.class.resource_name} must have a #{property}") if [:required] && (self.send(property).nil? || self.send(property).empty?) end true end |