Sha256: c5e435f24b94f5212263277e95b7228e44eda3df45b098d56b86b7a3838c0342
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
require "json_api_client/version" if ["1.1.1"].include?(JsonApiClient::VERSION) require "json_api_client/resource" module JsonApiClient class Resource def save return false unless valid? self.last_result_set = if persisted? self.class.requestor.update(self) else self.class.requestor.create(self) end if last_result_set.has_errors? last_result_set.errors.each do |error| if error.source_parameter errors.add(error.source_parameter, error.title || error.detail) else errors.add(:base, error.title || error.detail) end end false else self.errors.clear if self.errors mark_as_persisted! if updated = last_result_set.first self.attributes = updated.attributes # This line has been added as part of https://github.com/chingor13/json_api_client/pull/238 self.links.attributes = updated.links.attributes self.relationships.attributes = updated.relationships.attributes clear_changes_information # This line has been added as part of https://github.com/JsonApiClient/json_api_client/pull/285 self.relationships.clear_changes_information end true end end end end else raise %q( Please check these two PRs: * https://github.com/chingor13/json_api_client/pull/238 (This was released in version 1.5.0) * https://github.com/JsonApiClient/json_api_client/pull/285 (This hasn't yet been released at the time of writing this) If both have been merged into the gem version you are using, remove this file (#{__FILE__}). If not, add the current version to the allowed array at the top of this file. ) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flex_commerce_api-0.6.57 | lib/patches/json_api_client/resource.rb |