Class: Tag

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

Instance Method Summary collapse

Instance Method Details

#postsObject


16
17
18
# File 'app/models/tag.rb', line 16

def posts
  Post.where(id: post_ids)
end

#russian?Boolean

Returns:

  • (Boolean)

24
25
26
# File 'app/models/tag.rb', line 24

def russian?
  !!(title.to_s + aliases.to_s).mb_chars.downcase.match(/[а-я]/)
end

#self_and_aliasesObject


20
21
22
# File 'app/models/tag.rb', line 20

def self_and_aliases
  [title] + aliases.to_s.split(',').map(&:strip)
end

#title=(value) ⇒ Object


9
10
11
12
13
14
# File 'app/models/tag.rb', line 9

def title=(value)
  result = super
  set_slug

  result
end