summaryrefslogtreecommitdiff
path: root/app/models/concerns/valid_attribute.rb
blob: 8c35cea8d58310bb93446c2b4a0f734bbb8bc713 (plain)
1
2
3
4
5
6
7
8
9
10
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