app/assets/javascripts/models/base.coffee in kindred-rails-0.0.4 vs app/assets/javascripts/models/base.coffee in kindred-rails-0.0.5
- old
+ new
@@ -12,18 +12,24 @@
$.each collection, (i, attrs) ->
added_attrs.push($.extend attrs, opts.add_data_to_each)
data[@snake_name + "s"] = added_attrs
+ url_match = new RegExp(/{{([^{}]+)}}/g)
+ @route = @route.replace(url_match, (match, p1) =>
+ attribute = match.slice(2, - 2)
+ opts.add_data_to_each[attribute]
+ )
+
# TODO REMOVE THIS AFTER WEBKIT BUG FIX. https://github.com/thoughtbot/capybara-webkit/issues/553
# This conditonal is for testing but there is no easy fix at the moment.
# Put passes through data. Patch dosn't.
if (userAgent = window?.navigator?.userAgent).match /capybara-webkit/ || userAgent.match /PhantomJS/
path = @route + "/save_all.json"
method = 'PUT'
else
path = @route + "/save_all.json"
- method = 'PATCH'
+ method = 'PUT'
$.ajax
type: method
url: App.BaseUrl + "/" + path
data: data