Ruby on rails find an associated objects which has another association too

I have a three models, which organized this 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 I fetch all tasks, which taskable has at least one supply?


Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.