I have a Dog
model that can have many tags
and my Tag
model has the column type
. For the type
attribute I can only choose 3 different types:
class Tag
belongs_to :dog
TYPES = %w(Red Blue Green)
validates :type, inclusion: { :in => TYPES },
presence: true
end
In my seed file I have:
tags = Tag.create( [ { name: "Red Terrier", type: "Red" } ] )
I run the rake command and get the error:
rake aborted!
Invalid single-table inheritance type: Red is not a subclass of Tag
What's going on here? What's the way to do this and why does it think it's a subclass?