lundi 21 mai 2018

infer/add type_task from polymorphic child model

I have a parent class task and severals children tasks types something like this:

class Task
  field :name, type: String
  field :description, type: String
end

class Phase
  has_many :tasks, as: :taskable
end

class TaskManager < Task
 belongs_to :taskable, polymorphic: true
end

class TaskEmployee < Task
 belongs_to :taskable, polymorphic: true
end

When i'm creating a new task i would like add to task parent class a task_type children object.

How can i infer/add task_type object to parent task?

Thank you!

Aucun commentaire:

Enregistrer un commentaire