Class: ArmValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/models/arm_validator.rb

Overview

Validates Arm model.

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'app/models/arm_validator.rb', line 4

def validate(record)
  if ActiveRecord::Base
     .connection
     .column_exists?(:arms, :can_message_after_membership_complete) &&
     record.can_message_after_membership_complete.nil?
    record.errors[:base] << "An Arm must have a value for can_message"\
                            "_after_membership_complete"
  end
end