I'm in the midst of building out an adapter for data mapper and am running into an issue where create reports that a save is successful even though the save failed.
according to the documentation in abstract adapter, create should return the number of records that were actually saved to the datastore. however, this value is ignored and the save is assumed to be succesful as long as the attributes on the DataMapper::Resource are valid at the time it is to be persisted.
this is the block of code in question:
return self unless valid_attributes?
create_resource eventually calls the adapter's create method but this value is discarded. so in the case that the create fails, it still reports back as saving successfully.
i'd assumed that the return value was so that you could check that all records were successfully persisted. you could raise an exception from the adapter, but that seems pretty heavy-handed.
what would the "data_mapper" of handling this situation be? perhaps, returning the transient persistence state or another persistence state to indicate the create had failed but would allow for a normal retry as desired?