Class: Rpush::Client::ActiveModel::Pushy::TimeToLiveValidator

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

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



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

def validate(record)
  return if record.time_to_live.blank? || record.time_to_live <= 1.year.seconds
  record.errors.add(:time_to_live, 'The maximum value is 1 year')
end