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) {