Class: PostGroupTag

Inherits:
ApplicationRecord show all
Includes:
NestedPriority
Defined in:
app/models/post_group_tag.rb

Overview

Model for post category in category group

Attributes:

created_at [DateTime]
post_group_id [PostGroup]
 [PostTag]
priority [Integer]
updated_at [DateTime]

Class Method Summary collapse

Class Method Details

.[](slug) ⇒ Object

Parameters:



27
28
29
30
31
# File 'app/models/post_group_tag.rb', line 27

def self.[](slug)
  post_group = slug.is_a?(PostGroup) ? slug : PostGroup[slug]

  where(post_group: post_group).ordered_by_priority.map(&:post_tag)
end

.siblings(entity) ⇒ Object

Parameters:



22
23
24
# File 'app/models/post_group_tag.rb', line 22

def self.siblings(entity)
  where(post_group_id: entity.post_group_id)
end