app/models/concerns/errorable.rb
def error_messages( property )

    unless self.has_error?( property )
      return nil
    end

    # shortcut—if the user has entered nothing in a required field, just tell them that: it's pointless to tell them
    # it's required, and in the wrong format...
    if self.class.property_required?( property ) && self.send( property ).blank? && ( property != :password )
       return self.errors.generate_message( property, :blank )
    end

    ret = ''
    idx = 0
    self.errors[property].each do |msg|
      ret << ((idx == 0) ? msg : ", " + msg[0].downcase + msg[1..-1])
      idx += 1
    end

    ret
  end
# Utility function that concatenates all available validation error messages for the provided property.
Utility function that concatenates all available validation error messages for the provided property.
Utility function that concatenates all available validation error messages for the provided property .
def error_messages( property )
    unless self.has_error?( property )
      return nil
    end
    if self.class.property_required?( property ) && self.send( property ).blank? && ( property != :password )
       return self.errors.generate_message( property, :blank )
    end
    ret = ''
    idx = 0
    self.errors[property].each do |msg|
      ret << ((idx == 0) ? msg : ", " + msg[0].downcase + msg[1..-1])
      idx += 1
    end
    ret
  end
def error_messages ( property ) unless self . has_error? ( property ) return nil end if self . class . property_required? ( property ) && self . send ( property ) . blank? && ( property != :password ) return self . errors . generate_message ( property , :blank ) end ret = '' idx = 0 self . errors [ property ] . each do | msg | ret << ( ( idx == 0 ) ? msg : ", " + msg [ 0 ] . downcase + msg [ 1 .. - 1 ] ) idx += 1 end ret end
Utility function that concatenates all available validation error messages for the provided property.
Utility function that concatenates all available validation error messages for the provided property .
# shortcut—if the user has entered nothing in a required field, just tell them that: it's pointless to tell them # it's required, and in the wrong format...
property