views:

17

answers:

0

I'm trying to use ObjectiveResource to make an iPhone app speaking to my Ruby site. I can connect with log/pass, but I would like to have directly the account page on the first screen.

I retrieve the name like this : self.title = [ObjectiveResourceConfig getRemoteUser]; But unable to have all informations (always a nill object) when I try to get the userId.

On the ruby side my sessions_controller works like this

 def create
 user = User.authenticate(params[:session][:login], 
                          params[:session][:password])

 respond_to do |format|
   if user
     format.html do 
       reset_session
       session[:user_id] = user.id

       redirect_back_or_default user_path(user) 
     end
     format.any(:xml, :json) { head :ok }
   else
     format.html do 
       flash.now[:error] = "Invalid login or password."
       render :action => :new 
     end
     format.any(:xml, :json) { request_http_basic_authentication 'Web Password' }
   end
 end

end

How can I init the current user ? On the rails side, the session[:user_id] = user.id give me the right id but give me nill on the iPhone