I have a class named Post
:
class Post < ActiveRecord::Base
end
I have a class named Question
that inheriting from Post
:
class Question < Post
end
and I have a class named Answer
that also inheriting from 'Post':
class Answer < Post
end
In Post
, I have a column named post_type_id
and its' type is Integer
.
How do I use STI and specific column name & type to inherit from Post? 0
means Question
and 1
means Answer
. (0 & 1 is the value of post_type_id
in posts table)