Single Table Inheritance - Ruby on Rails Tutorial
Loading...
1,147
Loading...
Uploader Comments (charlesmaxwood)
see all
All Comments (2)
-
What if you wanted to use an int field for the type column? How would you do this?
Loading...
This system works on convention. I'm not sure there's a way to configure it to take an integer. You can't name classes with just integers anyhow and it expects you to put the class name in there.
You could skip using STI and put a type column as an integer in. Then your query would have to include "(type = 1)" or something similar.
charlesmaxwood 2 months ago