Apply Rails/Validation rubocop rule
This commit is contained in:
@@ -165,9 +165,6 @@ Rails/SkipsModelValidations:
|
||||
Rails/UniqBeforePluck:
|
||||
Enabled: true
|
||||
|
||||
Rails/Validation:
|
||||
Enabled: true
|
||||
|
||||
RSpec/AlignLeftLetBrace:
|
||||
Enabled: false
|
||||
|
||||
|
||||
@@ -157,6 +157,9 @@ Rails/UnknownEnv:
|
||||
- preproduction
|
||||
- staging
|
||||
|
||||
Rails/Validation:
|
||||
Enabled: true
|
||||
|
||||
RSpec/NotToNot:
|
||||
Enabled: true
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
class Budget
|
||||
class ContentBlock < ApplicationRecord
|
||||
validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
|
||||
validates :heading, presence: true
|
||||
validates_uniqueness_of :heading, scope: :locale
|
||||
validates :heading, presence: true, uniqueness: { scope: :locale }
|
||||
|
||||
belongs_to :heading
|
||||
end
|
||||
|
||||
@@ -3,12 +3,10 @@ class Newsletter < ApplicationRecord
|
||||
|
||||
validates :subject, presence: true
|
||||
validates :segment_recipient, presence: true
|
||||
validates :from, presence: true
|
||||
validates :from, presence: true, format: { with: /@/ }
|
||||
validates :body, presence: true
|
||||
validate :validate_segment_recipient
|
||||
|
||||
validates_format_of :from, :with => /@/
|
||||
|
||||
acts_as_paranoid column: :hidden_at
|
||||
include ActsAsParanoidAliases
|
||||
|
||||
|
||||
@@ -30,12 +30,9 @@ class VotationType < ApplicationRecord
|
||||
|
||||
validates :questionable, presence: true
|
||||
validates :questionable_type, inclusion: { in: QUESTIONABLE_TYPES }
|
||||
validates_presence_of :max_votes, allow_blank: false,
|
||||
if: :max_votes_required?
|
||||
validates_presence_of :max_groups_answers, allow_blank: false,
|
||||
if: :max_groups_answers_required?
|
||||
validates_presence_of :prioritization_type, allow_blank: false,
|
||||
if: :prioritization_type_required?
|
||||
validates :max_votes, presence: { allow_blank: false, if: :max_votes_required? }
|
||||
validates :max_groups_answers, presence: { allow_blank: false, if: :max_groups_answers_required? }
|
||||
validates :prioritization_type, presence: { allow_blank: false, if: :prioritization_type_required? }
|
||||
|
||||
after_create :add_skip_question_answer, if: :display_skip_question?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user