'"TypeError (superclass must be a Class (TrueClass given)):"

I am trying to connect my react frontend to my Rails backend. Upon testing, I am met with the following error:

TypeError (superclass must be a Class (TrueClass given)):
  
app/models/user.rb:1:in `<top (required)>'

My code:

class UsersController < ApplicationController

    def show
        user = User.find_by(id: session[:user_id])
        if user
            render json: user
        else
            render json: { error: "Not authorized" }, status: :unauthorized
        end
    end

    def create
        # byebug
        user = User.create(user_params)
        if user.valid?
            render json: user, status: :created
        else
            render json: { errors: user.errors.full_messages }, status: :unprocessable_entity
        end
    end

    private

    def user_params
        params.permit(:username, :password, :password_confirmation)
    end

end

Any assistance is appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source