Question

Here is the thing.

I'm working on a web game just for learning and I have this problem.

I have a Character who has many items, but the items can be equipable_items or usable_items (both from different clases).

Is there a way to have a has_many in my Character class to have a bag of items of both clases together?

Was it helpful?

Solution

Yes, check out Single Table Inheritance. You can do a has_many association to the parent class.

EDIT: Also check out the Single Table Inheritance section in the API documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top