Skip to content

Get Items for all children Categories

Michael edited this page Jul 10, 2016 · 1 revision
class Adv < ApplicationRecord
  belongs_to :cat
end

class Cat < ApplicationRecord
  has_closure_tree
  has_many :advs

  def indirect_advs
    Adv.where(:cat_id => descendant_ids)
  end
end
Clone this wiki locally