1

I'm making an app in rhodes that connects through rhoconnect with an asp.net mvc webservice. I'm confused how to handle 'current user id' in rhodes. An example of a function in asp.net is: getFriends(int personid), changeSettings(int personid) ... A new user has to register in rhodes and i send an http-post directly to asp.net to create the new user (so he can login in).

POST /ActiveUser/create

def create

@active_user = ActiveUser.create(@params['active_user'])
Rho::AsyncHttp.post(
        :url => "http://192.168.1.3/WS/Login/Register",
        :headers => {"Content-Type" => "application/json"}, 
        :body => "{Firstname:\"" + @params['active_user']['email'] + "\"}",
        :callback => (url_for :action => :httppost_callback),
        :callback_param => "" 
      )
redirect :action => :httpview

end

Right now i've created an active user model to save the current user and his settings. But i doubt that this is the right way to do it. So i was thinking to create the personid in asp.net and then return it? I can't seem to find an example how this issue is handled. (They never post a param in the query function in the source adapter) I don't know where and when to save the personid so i can access it all the time because i need it for almost every query in asp.net. (Store.put_value??). I've been searching for days now and I'm really stuck on this :(

Thanks !

user1245233
  • 45
  • 1
  • 5

1 Answers1

0

Declare a global variable in application.rb file, with in initialize method. such as

$user_details ||= {}

Then in your any others method of any controller u can access this variable and you can assign and update the value of this variable.

$user_details[:user_id] = 1