lib/active_remote/persistence.rb in active_remote-2.1.1 vs lib/active_remote/persistence.rb in active_remote-2.2.0
- old
+ new
@@ -174,13 +174,13 @@
# The service will run any validations and if any of them fail, will return
# the record with error messages indicating what went wrong.
#
# Also runs any before/after save callbacks that are defined.
#
- def save
+ def save(*args)
run_callbacks :save do
- create_or_update
+ create_or_update(*args)
end
end
# Saves the remote record.
#
@@ -190,12 +190,12 @@
# The service will run any validations. If any of them fail (e.g. error
# messages are returned), an ActiveRemote::RemoteRecordNotSaved is raised.
#
# Also runs any before/after save callbacks that are defined.
#
- def save!
- save || raise(RemoteRecordNotSaved)
+ def save!(*args)
+ save(*args) || raise(RemoteRecordNotSaved)
end
# Returns true if the record doesn't have errors; otherwise, returns false.
#
def success?
@@ -243,12 +243,12 @@
# Deterines whether the record should be created or updated. New records
# are created, existing records are updated. If the record is marked as
# readonly, an ActiveRemote::ReadOnlyRemoteRecord is raised.
#
- def create_or_update
+ def create_or_update(*args)
raise ReadOnlyRemoteRecord if readonly?
- new_record? ? create : update
+ new_record? ? create : update(*args)
end
# Handles updating a remote object and serializing it's attributes and
# errors from the response. Only attributes with the given attribute names
# (plus :guid) will be updated. Defaults to all attributes.