class Assent::Errors

Public Class Methods

new() click to toggle source
Calls superclass method Assent::Config::new
# File lib/assent/validations/errors.rb, line 7
def initialize
  @errors = Hash.new
  super
end

Public Instance Methods

add(field, rule) click to toggle source
# File lib/assent/validations/errors.rb, line 12
def add(field, rule)
  text = String.new(Config.config[rule.to_s])
  replace(text, field)
  @errors[field] ||= []
  @errors[field].push(text)
end
errors() click to toggle source
# File lib/assent/validations/errors.rb, line 19
def errors
  @errors
end
replace(text, field) click to toggle source
# File lib/assent/validations/errors.rb, line 23
def replace(text, field)
  message = text.sub! ':field', field.to_s
  return message
end