From 29ee49fc629c4fdb21338744cebe96ea4ad13af8 Mon Sep 17 00:00:00 2001 From: Mahdi Dibaiee Date: Wed, 13 Jul 2016 10:05:33 +0430 Subject: [PATCH] fix(name): default `name` parameter on `options` object itself --- package.json | 2 +- src/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ac43526..88207f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hapi-sequelize-crud", - "version": "2.3.0", + "version": "2.3.1", "description": "Hapi plugin that automatically generates RESTful API for CRUD", "main": "build/index.js", "config": { diff --git a/src/index.js b/src/index.js index 320bf83..b64af0b 100644 --- a/src/index.js +++ b/src/index.js @@ -8,9 +8,9 @@ import qs from 'qs'; const register = (server, options = {}, next) => { options.prefix = options.prefix || ''; + options.name = options.name || 'db'; - const name = options.name || 'db'; - const db = server.plugins['hapi-sequelize'][name]; + const db = server.plugins['hapi-sequelize'][options.name]; const models = db.sequelize.models; const onRequest = function (request, reply) {