Don't try to save invalid resources

We were saving the resource after checking it was valid, but it will
always return false if the model isn't valid.
This commit is contained in:
Javi Martín
2019-10-20 01:20:20 +02:00
parent 0671c72c98
commit 777fb55399

View File

@@ -24,10 +24,10 @@ class RemoteTranslations::Caller
def destroy_remote_translation def destroy_remote_translation
if resource.valid? if resource.valid?
remote_translation.destroy remote_translation.destroy
resource.save!
else else
remote_translation.update(error_message: resource.errors.messages) remote_translation.update(error_message: resource.errors.messages)
end end
resource.save
end end
def resource def resource