Ruby on rails find an associated objects which has another association too -
i have 3 models, organized way:
class task < ar::base has_one :taskable class taskable belongs_to :task has_many :supplies class supply < ar::base belongs_to :taskable
how can fetch tasks, taskable has @ least 1 supply?
you need join query .
# fetch tasks, taskable has @ least 1 supply task.joins(taskable: :supplies)
Comments
Post a Comment