lib/fanforce/validations/validations.rb in fanforce-validations-0.3.3 vs lib/fanforce/validations/validations.rb in fanforce-validations-0.4.0
- old
+ new
@@ -71,17 +71,17 @@
errors = invalid_fields.inject([]) {|result, f| result << format_validation_error(opts, f, :invalid_data) }
raise_validation_errors(opts, errors, Fanforce::Error::RequestFailed)
end
def validates_format_of_external_id(*args)
+ _external_id = args.first
opts = extract_options!(args).merge(:field => :_external_id)
params = extract_validation_params(opts)
- _external_id = args.first
if is_present?(_external_id) and !_external_id.is_a?(String)
- opts[:message] = "id must be a string but was a #{_external_id.class.name}"
+ opts[:message] = "if included, _external_id must be a string not a #{_external_id.class.name}"
elsif !_external_id.nil? and _external_id.include?('/')
- opts[:message] = 'id cannot contain forward slashes (/)'
+ opts[:message] = '_external_id cannot contain forward slashes (/)'
else
return true
end
error = format_validation_error(opts, :_external_id, :invalid_data)
\ No newline at end of file