From af1d5e4a3b4d12aae84238af38f510a874b57a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20Mar=C3=ADa=20Mart=C3=ADnez=20G=C3=B3mez?= Date: Thu, 16 May 2019 17:07:05 +0200 Subject: [PATCH] Do no use string in `if` conditional Passing string to be evaluated in :if and :unless conditional options is not supported. Pass a symbol for an instance method, or a lambda, proc or block, instead. --- app/models/survey_question.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/survey_question.rb b/app/models/survey_question.rb index 7f3f7750..e1cb0427 100644 --- a/app/models/survey_question.rb +++ b/app/models/survey_question.rb @@ -10,7 +10,7 @@ class SurveyQuestion < ActiveRecord::Base ICONS = { boolean: 'dot-circle-o', choice: 'check-square-o', string: 'edit', text: 'align-left', datetime: 'clock-o', numeric: 'slack' }.freeze validates :title, presence: true - validates :possible_answers, :max_choices, :min_choices, presence: true, if: 'choice?' + validates :possible_answers, :max_choices, :min_choices, presence: true, if: :choice? validates :min_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true validates :max_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true