Permalink
Browse files

Moved prepareParams out of xhr.js as it requires Form object.

  • Loading branch information...
1 parent 4ad4db5 commit 654a6024811dc4c7411f997d7c51248d1b2f0424 @jakubpawlowicz committed Sep 21, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/xhr/form.js
View
@@ -82,3 +82,19 @@ function Form_remote_send(event, options) {
event.stop();
this.send(options);
}
+
+/**
+ * Adds Xhr params handling if a Form element is passed to Xhr#send
+ *
+ * @param Object params - could be Hash or Form element
+ * @return Object
+ */
+Xhr.include({
+ prepareParams: function(params) {
+ if (params && params instanceof Form) {
+ this.form = params;
+ params = params.values();
+ }
+ return params;
+ }
+});

0 comments on commit 654a602

Please sign in to comment.