1 Reply Latest reply on Oct 27, 2009 2:10 PM by flairjax

    Flex and Rails PUT

    flairjax Level 1

      Anyone know why this won't work when I call my Update CRUD method?
      I have tried it without this.service.headers ="{{X_HTTP_METHOD_OVERRIDE:'PUT'}}" using /savedthing/+ id + '?_method=PUT' for the urlString, but still no luck.

       

      public function shouldUpdateMapToRails( id:String, name:String, customdata:String, origdata:String ) : void
              {
                  // constructor will store a reference to the service we're going to call
                  this.service = new HTTPService();
                  this.service.method = 'POST';
                  this.service.contentType = "application/x-www-form-urlencoded";
                  this.service.headers ="{{X_HTTP_METHOD_OVERRIDE:'PUT'}}"
                  this.service.resultFormat ="e4x";
                  /* PRODUCTION VERSION =================================================*/
                  var  urlString:String = "/savedthing/" + id;
                  _params = { 'saved_thing[myname]': name, 'saved_thing[customdata]': customdata, 'saved_thing[originaldata]': origdata };
                  this.service.url=urlString;
              }

       

      other way I have tried it

       

      public function shouldUpdateMapToRails( id:String, name:String, customdata:String, origdata:String ) : void
               {
                   // constructor will store a reference to the service we're going to call
                   this.service = new HTTPService();
                   this.service.method = 'POST';
                   this.service.contentType = "application/x-www-form-urlencoded";
                 
                   this.service.resultFormat ="e4x";
                   /* PRODUCTION VERSION =================================================*/
                   var  urlString:String = "/savedthing/" + id + '?_method=PUT';
                   _params = { 'saved_thing[myname]': name, 'saved_thing[customdata]': customdata, 'saved_thing[originaldata]': origdata };
                   this.service.url=urlString;
               }