```ruby
module SessionsHelper
  # signs in a user
  def sign_in user
    session[:user_id] = user.id
  end

  # signs out a user
  def sign_out
    session.delete :user_id
    @current_user = nil
  end

  # returns the current signed in user, if one exists
  def current_user
    @current_user ||= User.find_by(id: session[:user_id])  
  end

  # is user signed in?
  def signed_in?
    !current_user.nil?
  end
end
```

Add remember method to sessions helper to call user remember method, and set secure cookies for user id and remember token. Add call to remember helper in session controller create action.
user
```ruby
module SessionsHelper
  # signs in a user
  def sign_in user
    session[:user_id] = user.id
  end

  # signs out a user
  def sign_out
    session.delete :user_id
    @current_user = nil
  end

  # returns the current signed in user, if one exists
  def current_user
    @current_user ||= User.find_by(id: session[:user_id])  
  end

  # is user signed in?
  def signed_in?
    !current_user.nil?
  end

  # remembers a user in a persistent session (secure cookie)
  def remember(user)
    user.remember
    cookies.permanent.signed[:user_id] = user.id
    cookies.permanent[:remember_token] = user.remember_token
  end
end
```
assistant