title: Rails with Devise and user_id in cookie
body: <p>I build Rails app and now try to install CometChat for it. On installation instruction is function like this:</p>
  
  <pre><code>function getUserID() {
      $userid = 0; // Return 0 if user is not logged in
  
      if (!empty($_COOKIE['userid'])) {
          $userid = $_COOKIE['userid'];
      }
  
      return $userid;
  }
  </code></pre>
  
  <p>As i understand i need userid in cookie, right? How can i change this code to work with rails sessions. </p>
  
  <p>I set (i think) cookie like this in Session_controller - finded on stackoverflow:</p>
  
  <pre><code>def create
    cookies[:sign_in] = current_user.id
    super
  end
  
    # GET /resource/sign_out
    def destroy
      cookies[:sign_out] = current_user.id
      super
    end
  </code></pre>
  
  <p>But im do not know how to integrate with this function getUserID. Can somebody help with that - i do not know php and dont want to destroy something :)</p>