Skip to content

Commit

Permalink
don't match :3000 and allow for methods as well as attributes in rest…
Browse files Browse the repository at this point in the history
… path
  • Loading branch information
jlsync committed Mar 27, 2011
1 parent 2fb9ae6 commit 64d780c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/model_rest.js
@@ -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
Expand All @@ -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;
},
Expand Down

0 comments on commit 64d780c

Please sign in to comment.