Right. I understand that. But in case of ‘type’ driven STI, a person
can just have one type. I don’t want to use HABTM with roles because I
want to seperate logic for different type of people.
I’m looking for something that lets me scope the inherited table
instead of using type field. Something like :
class Goalkeeper < Person
:scope => “type_id = 4”
end
And not have multiple boolean columns like in my people table like is
is_goalkpeer, is_forward, is_defender.
Hi Pratik,
I guess you have no way to use the STI in this scenario. I’d go with a
Person model that contains all the data except the role and create a
Role model/table.
Then Role belongs_to Person and Person has_many Roles.
Cheers.
For this type of thing, I use the acts_as_taggable plugin. Then you can
tag each person with each role that they fulfill and you won’t clutter
up your model with extraneous fields.
And not have multiple boolean columns like in my people table like is
is_goalkpeer, is_forward, is_defender.
Hi Pratik,
I guess you have no way to use the STI in this scenario. I’d go with a
Person model that contains all the data except the role and create a
Role model/table.
Then Role belongs_to Person and Person has_many Roles.
Cheers.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.