Browse files

Support push state configuration for resources

  • Loading branch information...
1 parent b041823 commit d8c3ee320c30fcf2a82f11fe079319eb9c3b2ddd @1602 committed Jan 21, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/railway_routes.js
View
5 lib/railway_routes.js
@@ -175,7 +175,7 @@ Map.prototype.addPath = function (templatePath, action, helperName) {
arg = arguments[i];
if (arg && typeof arg.to_param == 'function') {
value = arg.to_param();
- } else if (typeof arg === 'object' && arg.id && arg.constructor.name !== 'ObjectID') {
+ } else if (arg && typeof arg === 'object' && arg.id && arg.constructor.name !== 'ObjectID') {
value = arg.id;
} else {
value = arg && arg.toString ? arg.toString() : arg;
@@ -373,6 +373,9 @@ Map.prototype.resources = function (name, params, actions) {
aname = self.urlHelperName(self.globPath + aname);
p.as = action === 'new' || action === 'edit' ? action + '_' + aname : aname;
}
+ if ('state' in params) {
+ p.state = params.state;
+ }
return p;
}
};

0 comments on commit d8c3ee3

Please sign in to comment.