lib/ridley/resource.rb in ridley-0.5.2 vs lib/ridley/resource.rb in ridley-0.6.0

- old
+ new

@@ -232,16 +232,29 @@ # # @raise [Errors::InvalidResource] # if the resource does not pass validations # # @return [Boolean] - # true if successful and false for failure def save raise Errors::InvalidResource.new(self.errors) unless valid? self.attributes = self.class.create(connection, self).attributes true rescue Errors::HTTPConflict + self.update + true + end + + # Updates the instantiated resource on the target remote with any changes made + # to self + # + # @raise [Errors::InvalidResource] + # if the resource does not pass validations + # + # @return [Boolean] + def update + raise Errors::InvalidResource.new(self.errors) unless valid? + self.attributes = self.class.update(connection, self).attributes true end # Reload the attributes of the instantiated resource