Class: Sequencescape::Api::Associations::InstanceMethods::CompositeErrors

Inherits:
ActiveModel::Errors
  • Object
show all
Defined in:
lib/sequencescape-api/associations.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) [](field)



71
72
73
74
75
# File 'lib/sequencescape-api/associations.rb', line 71

def [](field)
  association, *subfield = field.to_s.split('.')
  errors_from_association = associations[association.to_sym].try(:errors).try(:[], subfield.join('.')) 
  errors_from_association.blank? ? super : errors_from_association
end

- (Object) clear



85
86
87
88
# File 'lib/sequencescape-api/associations.rb', line 85

def clear
  association_errors.map(&:clear)
  super 
end

- (Boolean) empty?



81
82
83
# File 'lib/sequencescape-api/associations.rb', line 81

def empty?
  super and association_errors.all?(&:empty?)
end

- (Object) full_messages



77
78
79
# File 'lib/sequencescape-api/associations.rb', line 77

def full_messages
  super.concat(association_errors.map(&:full_messages)).flatten
end