If session[:user_id] is nil then you should return HTTP 401, like so: 
```render :nothing => true, :status => 401```