lib/rest/api/client.rb in rest-api-client-0.1.6 vs lib/rest/api/client.rb in rest-api-client-0.1.7

- old
+ new

@@ -10,12 +10,12 @@ require 'rest/api/client/request_handler' module RestApiClient class RestModel - extend ActiveModel::Naming - extend ActiveModel::Translation + extend ActiveModel::Naming + extend ActiveModel::Translation include Virtus.model(:nullify_blank => true) include ActiveModel::Conversion include ActiveModel::Validations @@ -41,19 +41,22 @@ def self.get(id) self.find id end def save! + return false unless valid? begin update_attributes(perform_post path, get_params) self rescue RestApiClient::ModelErrorsException => e @errors = e.errors raise e end end def save + return false unless valid? + begin update_attributes(perform_post path, get_params) self rescue RestApiClient::ModelErrorsException => e @errors = e.errors