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
self.table_name = "MyTable"
self.primary_key = "MyKey"
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?
The `current_user` object is only available inside of a rhoconnect application (i.e. source adapter model or controller). It's not available through rhoconnect-rb plugin. The intention of the partition method is for you to use your rails app's user model.