1# frozen_string_literal: true 2 3module ValidAttribute 4 extend ActiveSupport::Concern 5 6 # Checks whether an attribute has failed validation or not 7 # 8 # +attribute+ The symbolised name of the attribute i.e :name 9 def valid_attribute?(attribute) 10 self.errors.empty? || self.errors.messages[attribute].nil? 11 end 12end 13