1 Reply Latest reply on Nov 20, 2013 9:27 AM by Lars Burgess

    Rhoconnect error when updating sql server

    Tahir Zamir



      I see the following error when trying to update records in a sql server database which Rhoconnect syncs with client devices:-


           rhoconnect_update returned unexpected error: undefined local variable or method `current_user'


      The architecture of the solution is such that the update request comes from a .net application and is in a RESTful format.


      The update itself is successful. 


      It appears that the error is generated from the model defined in the plugin:-


      class MyClass < ActiveRecord::Base

        include Rhoconnectrb::Resource


        self.table_name = "MyTable"

        self.primary_key = "MyKey"


        def partition

          lambda {current_user.login}



        def self.rhoconnect_query(partition, attributes = nil)

          MyClass.where("MyKey = ?", partition)



        attr_accessible :MyKey, ...



      The update call from the .net app is a POST request and has the api_token embedded within the request. 


      I make many other calls from the .net app to insert data into the database using exactly the same mechanism and these are all successful and don't generate any errors, why should the update be any different?