Permalink
Browse files

Added param to disable automatic appending of '.format?'

  • Loading branch information...
1 parent f1f5ad2 commit fb33d3db0cebd71962b1a71c52dcbb32765dafea @olalonde olalonde committed Oct 31, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/railway_routes.js
View
@@ -219,6 +219,8 @@ Map.prototype.resources = function (name, params, actions) {
var self = this;
// params are optional
params = params || {};
+ params.appendFormat = (params.appendFormat == null) ? params.appendFormat : true;
+
// if params arg omitted, second arg may be `actions`
if (typeof params == 'function') {
actions = params;
@@ -254,10 +256,12 @@ Map.prototype.resources = function (name, params, actions) {
var path = route[1];
// append format
- if (path == '/') {
- path = '.:format?';
- } else {
- path += '.:format?';
+ if (params.appendFormat) {
+ if (path == '/') {
+ path = '.:format?';
+ } else {
+ path += '.:format?';
+ }
}
// middleware logic (backward compatibility)

0 comments on commit fb33d3d

Please sign in to comment.