Class: ActiveModel::Errors
- Inherits:
-
Object
- Object
- ActiveModel::Errors
- Defined in:
- lib/common_lib/active_model/errors.rb
Instance Method Summary collapse
Instance Method Details
#matching?(attribute, message) ⇒ Boolean
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/common_lib/active_model/errors.rb', line 3 def matching?(attribute,) #>> a.errors.messages[:cbc_report_found] #=> ["is not included in the list"] #>> a.errors.messages[:cbc_report_found].any?{|m| m.match(/include/)} #=> true #>> a.errors.messages[:cbc_report_found].any?{|m| m.match(/inclue/)} #=> false # all keys seem to be converted to symbols? NOT indifferent. self.include?(attribute.to_sym) && self.[attribute.to_sym].any?{|m| m.match(/#{message.to_s}/) } # @messages[attribute.to_sym].any?{|m| m.match(/#{message.to_s}/) } end |