Class: Decidim::Category

Inherits:
ApplicationRecord show all
Defined in:
app/models/decidim/category.rb

Overview

Categories serve as a taxonomy for components to use for while in the context of a participatory process.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.first_classObject

Scope to return only the first-class categories, that is, those that are not subcategories.

Returns an ActiveRecord::Relation.



19
20
21
# File 'app/models/decidim/category.rb', line 19

def self.first_class
  where(parent_id: nil)
end

Instance Method Details

#unused?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/decidim/category.rb', line 23

def unused?
  categorizations.empty?
end