increase poll option limit to 25, text limit to 150, and allow single option polls

This commit is contained in:
ida schmidt 2019-09-24 05:04:47 -07:00
parent acc8db28c3
commit dd9c46a619

View file

@ -1,8 +1,8 @@
# frozen_string_literal: true
class PollOptionsValidator < ActiveModel::Validator
MAX_OPTIONS = 4
MAX_OPTION_CHARS = 50
MAX_OPTIONS = 25
MAX_OPTION_CHARS = 150
def validate(poll)
poll.errors.add(:options, I18n.t('polls.errors.too_few_options')) unless poll.options.size > 1