Paul
Paul

Reputation: 858

Spree get all taxons from underlying taxonomy

How to get all taxons that are children of a certain taxonomy.

I retrieve the taxonomy like this:

Spree::Taxonomy.find_by_machine_name('product_categories')

Upvotes: 0

Views: 861

Answers (1)

gmacdougall
gmacdougall

Reputation: 4911

A Spree::Taxonomy has_many :taxons so you should be able to do:

Spree::Taxonomy.find_by_machine_name('product_categories').taxons

Upvotes: 1

Related Questions