Skip to content

Commit abfe31e

Browse files
committed
feature(objectIds): Added support for Mongo ObjectIds to actionRouting and restfulRouting
1 parent f848f7b commit abfe31e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ module.exports = Class.extend(
171171
// Route based on an action first if we can
172172
if ( this.Class.actionRouting && typeof this.req.params !== 'undefined' && typeof this.req.params.action !== 'undefined' ) {
173173
// Action Defined Routing
174-
if ( isNaN( this.req.params.action ) ) {
174+
// Updated to consider ObjectId's as numbers for Mongo ids
175+
if ( !/^[0-9a-fA-F]{24}$/.test( this.req.params.action ) && isNaN( this.req.params.action ) ) {
175176
funcName = this.req.params.action + 'Action';
176177

177178
if ( typeof this[ funcName ] == 'function' ) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "clever-controller",
33
"description": "Lightning-fast flexible controller prototype",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"private": false,
66
"repository": {
77
"type": "git",

0 commit comments

Comments
 (0)