lib/fanforce/validations/validations.rb in fanforce-validations-0.4.2 vs lib/fanforce/validations/validations.rb in fanforce-validations-0.5.0
- old
+ new
@@ -70,24 +70,9 @@
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)
-
- if _external_id.to_s.include?('/')
- opts[:message] = '_external_id contains one or more forward slashes (/), which is not allowed'
- else
- return true
- end
-
- errors = [format_validation_error(opts, :_external_id, :invalid_data)]
- raise_validation_errors(opts, errors, Fanforce::Error::RequestFailed)
- end
-
def format_validation_error(opts, fields, default_error_code=nil)
error = {
resource: is_present?(opts[:resource]) ? opts[:resource] : (self.class==Class ? self.name.demodulize.tableize.singularize : self.class.name.demodulize.tableize.singularize),
code: is_present?(opts[:code]) ? opts[:code] : default_error_code,
message: opts[:message]
\ No newline at end of file