Permalink
Browse files

don't match :3000 and allow for methods as well as attributes in rest…

… path
  • Loading branch information...
jlsync committed Mar 27, 2011
1 parent 2fb9ae6 commit 64d780ce27e37d2f7eae40a86b606099a84a7947
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/model_rest.js
View
@@ -1,5 +1,5 @@
Model.REST = function(klass, resource, methods) {
- var PARAM_NAME_MATCHER = /:([\w\d]+)/g;
+ var PARAM_NAME_MATCHER = /:([\w]+)/g;
var resource_param_names = (function() {
var resource_param_names = []
var param_name
@@ -15,7 +15,7 @@ Model.REST = function(klass, resource, methods) {
path: function(model) {
var path = resource;
jQuery.each(resource_param_names, function(i, param) {
- path = path.replace(":" + param, model.attributes[param]);
+ path = path.replace(":" + param, model.attributes[param] || (model[param] && model[param]()) || (":" + param));
});
return path;
},

0 comments on commit 64d780c

Please sign in to comment.