Class: C80NewsTz::Notice

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/c80_news_tz/notice.rb

Instance Method Summary collapse

Instance Method Details

#normalize_friendly_id(input) ⇒ Object



27
28
29
# File 'app/models/c80_news_tz/notice.rb', line 27

def normalize_friendly_id(input)
  input.to_s.to_slug.normalize(transliterations: :russian).to_s
end

#should_generate_new_friendly_id?Boolean

Returns:

  • (Boolean)


35
36
37
38
# File 'app/models/c80_news_tz/notice.rb', line 35

def should_generate_new_friendly_id?
  slug.blank?
  # name_changed? || super
end

#slug_candidatesObject



31
32
33
# File 'app/models/c80_news_tz/notice.rb', line 31

def slug_candidates
  [:title] + Array.new(6) { |index| [:title, index+2] }
end