TypeError: superclass mismatch for class Word in Ruby

前端 未结 4 1345
生来不讨喜
生来不讨喜 2020-12-05 17:37

I am creating a Word class and I am getting an error:

TypeError: superclass mismatch for class Word

Here is the

4条回答
  •  长情又很酷
    2020-12-05 18:11

    A thumb rule for irb (either way irb or rails console)

    If you are creating the same class twice with inheritance (superclass), exit the irb instance and create it again. Why this? Because otherwise class conflicts will happen.

    In your case, you are using Windows (found from the question), so just type exit on DOS prompt and again type irb or rails console and create your Word class and it should work. Please let me know if it doesn't work for you.

提交回复
热议问题