Welcome to mirror list, hosted at ThFree Co, Russian Federation.

valid_attribute.rb « concerns « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 251db9ce30b41021704858b2120d59c8ad7467fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

module ValidAttribute
  extend ActiveSupport::Concern

  # Checks whether an attribute has failed validation or not
  #
  # +attribute+ The symbolised name of the attribute i.e :name
  def valid_attribute?(attribute)
    self.errors.empty? || self.errors.messages[attribute].nil?
  end
end