Class: Rpush::Client::ActiveModel::RegistrationIdsCountValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/rpush/client/active_model/registration_ids_count_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object


5
6
7
8
9
# File 'lib/rpush/client/active_model/registration_ids_count_validator.rb', line 5

def validate(record)
  limit = options[:limit] || 100
  return unless record.registration_ids && record.registration_ids.size > limit
  record.errors[:base] << "Number of registration_ids cannot be larger than #{limit}."
end