This method is deprecated or moved on the latest stable version.
The last existing version (v3.2.13) is shown here.
save_with_validation(options={})
public
Validate a resource and save (POST) it to the remote web service. If any
local validations fail - the save (POST) will not be attempted.
# File activeresource/lib/active_resource/validations.rb, line 71
def save_with_validation(options={})
perform_validation = options[:validate] != false
# clear the remote validations so they don't interfere with the local
# ones. Otherwise we get an endless loop and can never change the
# fields so as to make the resource valid.
@remote_errors = nil
if perform_validation && valid? || !perform_validation
save_without_validation
true
else
false
end
rescue ResourceInvalid => error
# cache the remote errors because every call to <tt>valid?</tt> clears
# all errors. We must keep a copy to add these back after local
# validations.
@remote_errors = error
load_remote_errors(@remote_errors, true)
false
end