Module: ValidAttribute

Extended by:
ActiveSupport::Concern
Included in:
Project
Defined in:
app/models/concerns/valid_attribute.rb

Instance Method Summary collapse

Instance Method Details

#valid_attribute?(attribute) ⇒ Boolean

Checks whether an attribute has failed validation or not

attribute The symbolised name of the attribute i.e :name

Returns:

  • (Boolean)

9
10
11
# File 'app/models/concerns/valid_attribute.rb', line 9

def valid_attribute?(attribute)
  self.errors.empty? || self.errors.messages[attribute].nil?
end