summaryrefslogtreecommitdiff
path: root/app/models/concerns/valid_attribute.rb
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