In Files

Parent

Included Modules

Files

Class Index [+]

Quicksearch

Validatable::Errors

Public Instance Methods

full_messages → an_array_of_messages click to toggle source

Returns an array containing the full list of error messages.

    # File lib/errors.rb, line 53
53:     def full_messages
54:       full_messages = []
55: 
56:       errors.each_key do |attribute|
57:         errors[attribute].each do |msg|
58:           next if msg.nil?
59: 
60:           if attribute.to_s == "base"
61:             full_messages << msg
62:           else
63:             full_messages << humanize(attribute.to_s) + " " + msg
64:           end
65:         end
66:       end
67:       full_messages
68:     end
on(attribute) click to toggle source
  • Returns nil, if no errors are associated with the specified attribute.

  • Returns the error message, if one error is associated with the specified attribute.

  • Returns an array of error messages, if more than one error is associated with the specified attribute.

    # File lib/errors.rb, line 13
13:     def on(attribute)
14:       return nil if errors[attribute.to_sym].nil?
15:       errors[attribute.to_sym].size == 1 ? errors[attribute.to_sym].first : errors[attribute.to_sym]
16:     end
raw(attribute) click to toggle source
  • Returns an array of error messages associated with the specified attribute.

    # File lib/errors.rb, line 38
38:     def raw(attribute)
39:       errors[attribute.to_sym]
40:     end
replace(attribute) click to toggle source
  • Replaces the errors value for the given attribute

    # File lib/errors.rb, line 31
31:     def replace(attribute, value)
32:       errors[attribute.to_sym] = value
33:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.