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