Skip to content

superclass mismatch for class Team when inheriting from ApplicationRecord #102

@khyatisoneji

Description

@khyatisoneji

I am using Rails and I have created my own team and user model.

I have specified it in models.rb file:

require './app/models/team.rb'
require './app/models/user'
require './app/models/question.rb'

If I have Team as an Active Record, then it says superclass mismatch.

class Team < ApplicationRecord
  has_many :users
end

If I simply have it as a class, it doesn't provide with team.users function.

class Team
  has_many :users
end

The above code throws exception saying that team.users function doesn't exist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions