2 Replies Latest reply on Jan 26, 2013 11:08 AM by Andraž Stošić

    storeserver demo application problem

    Andraž Stošić

      Hi,

       

      i was following the tutorial on docs site to create first rhoconnect application. I was preety much copy/pasting everything but application still doesn't work - to be exact sycing doensn't work and I can't seem to find out where the problem is.

       

      In rhoconnect project (named storeserver) i defined new model "product" and under query method of Product object i've passed in:

       

      parsed = JSON.parse(RestClient.get("#{@base}.json").body)

      @result = {}

      parsed.each do |item|

      @result[item["product"]["id"].to_s] = item["product"]

      end

       

      where @base variable is defined in initialize method as tutorial is stating:

      @base = 'http://rhostore.herokuapp.com/products'

       

      i didn't change anything else in storeserver project. I've created another project (rhomobile application named storemanager) to test syncing with my rhoconnect application. The steps i've taken are:

       

      - create new model with following parameters name, brand, price, quantity, sku

      - uncommnet the sync line in product.rb

      added syncserver = 'http://localhost:9292/application' line in my rhoconfig.txt

       

      I've started everything up (rhoconnect, redis, rhomobile in RhoSimulator as WindowsMobile app) and logged in. I can see the newly created user on rhoconect console, i get device id but no data are synced. I've noticed one message when i was browsing rhoconnect console.

       

      If i click on user and on my newly created user than i click on Product (under sources section) and source:application:test:errors i see the followng message:

       

      "query-error":{

              "message":"Please provide some code to read records from the backend data source"

          }

       

      it all seems like i have problem in my rhoconnect product adapter in query method. But i don't see any errors there.

       

      Thanks for your help!

       

      Regards.

        • Re: storeserver demo application problem

          Did you comment out the raise in the method?  When you generate a source adapter, the boilerplate query method looks like this:

           

            def query(params=nil)
              # TODO: Query your backend data source and assign the records 
              # to a nested hash structure called @result. For example:
              # @result = { 
              #   "1"=>{"name"=>"Acme", "industry"=>"Electronics"},
              #   "2"=>{"name"=>"Best", "industry"=>"Software"}
              # }
              raise SourceAdapterException.new("Please provide some code to read records from the backend data source")
            end
          

           

          Line 8 is intended to be removed when you put your code in there.  Otherwise it will always just raise an exception .