partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit aa6b8e680e6c5995608537040fe4b29b1b8326f1
parent 92f92a401dbb4c638da7c65a5580de6e9480dc9a
Author: Felicitus <felicitus@felicitus.org>
Date:   Mon, 22 Jun 2015 19:40:40 +0200

Trigger exception when the amount of records is != 1

Diffstat:
Msrc/PartKeepr/FrontendBundle/Resources/public/js/Data/RestProxy.js | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Data/RestProxy.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Data/RestProxy.js @@ -50,13 +50,16 @@ Ext.define("PartKeepr.data.RestProxy", { } if (request.getAction() == "update") { - if (request.getRecords().length > 1) { + if (request.getRecords().length != 1) { throw "The amount of records updating must be exactly one"; } this.api.update = request.getRecords()[0].getId(); } if (request.getAction() == "destroy") { + if (request.getRecords().length != 1) { + throw "The amount of records updating must be exactly one"; + } this.api.destroy = request.getRecords()[0].getId(); }