3 Replies Latest reply on Mar 7, 2014 8:27 AM by Ruben Ruben

    Javascript Rhom API - changes on DB won't trigger PUT

    Ruben Ruben

      Hi,

       

      I've already used RhoConnect inside a Rhomobile ruby-based app, and as i've previously seen, calling sync after adding a new object to the local DB will trigger a PUT in the RhoConnect server towards my backend server.

       

      However, when using the Javascript API, when I do this I just see a GET, as if it was just checking for new objects in the backend server.


      If I open the local SQLite database with a SQLite manager after adding a new object, I will see the object in the table, but if I do:

           SELECT * FROM changed_values;

      i will get nothing.

       

       

      My model:

       

      var activity = Rho.ORM.addModel(function(model) {

          //Model settings:

          model.modelName("Activity");

          model.enable("sync");

          model.enable("fixedSchema");

         

          //Model definition:   

          model.property("date", "string");

          model.property("timeStart", "string");

          model.property("timeEnd", "string");

          model.property("duration", "string");

          model.property("description", "string");

      });

       

      My angularJS insert method in my factory:

      ...

      insert: function (val) {

                      // Create a new RhoMobile database object.

                      var obj = activity.create(val);

                      // Add record to database table.

                      var hsh = this.hash(obj);

                      this.items.push(hsh);

                     

                      return hsh;

                  },

      ....

       

      Am I doing something wrong?

       

      Thanks.