Class: C80NewsTz::Notice
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- C80NewsTz::Notice
- Extended by:
- FriendlyId
- Defined in:
- app/models/c80_news_tz/notice.rb
Instance Method Summary collapse
- #normalize_friendly_id(input) ⇒ Object
- #should_generate_new_friendly_id? ⇒ Boolean
- #slug_candidates ⇒ Object
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
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_candidates ⇒ Object
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 |