Class: PostGroupCategory
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- PostGroupCategory
- Includes:
- NestedPriority
- Defined in:
- app/models/post_group_category.rb
Overview
Model for post category in category group
Attributes:
created_at [DateTime]
post_category_id [PostCategory]
post_group_id [PostGroup]
priority [Integer]
updated_at [DateTime]
Class Method Summary collapse
Class Method Details
.[](slug) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/models/post_group_category.rb', line 27 def self.[](slug) post_group = slug.is_a?(PostGroup) ? slug : PostGroup[slug] where(post_group: post_group).ordered_by_priority.map do |link| next unless link.post_category.visible? link.post_category end.compact end |
.siblings(entity) ⇒ Object
22 23 24 |
# File 'app/models/post_group_category.rb', line 22 def self.siblings(entity) where(post_group_id: entity.post_group_id) end |