Class: C80News::Fact
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- C80News::Fact
- Extended by:
- FriendlyId
- Defined in:
- app/models/c80_news/fact.rb
Instance Method Summary collapse
- #normalize_friendly_id(input) ⇒ Object
- #short_meta_description ⇒ Object
- #slug_candidates ⇒ Object
- #thumb_lg ⇒ Object
- #thumb_md ⇒ Object
- #thumb_preview ⇒ Object
- #thumb_sm ⇒ Object
Instance Method Details
#normalize_friendly_id(input) ⇒ Object
18 19 20 |
# File 'app/models/c80_news/fact.rb', line 18 def normalize_friendly_id(input) input.to_s.to_slug.normalize(transliterations: :russian).to_s end |
#short_meta_description ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/c80_news/fact.rb', line 26 def if description.present? && description.length > 200 result = description elsif full.present? && full.length > 0 result = (full[0..200]+"...") else result = nil end result end |
#slug_candidates ⇒ Object
22 23 24 |
# File 'app/models/c80_news/fact.rb', line 22 def slug_candidates [:title] + Array.new(6) {|index| [:title, index+2]} end |
#thumb_lg ⇒ Object
55 56 57 58 59 60 61 |
# File 'app/models/c80_news/fact.rb', line 55 def thumb_lg s = '' if fphotos.count > 0 s = fphotos.first.image.thumb_lg end s end |
#thumb_md ⇒ Object
47 48 49 50 51 52 53 |
# File 'app/models/c80_news/fact.rb', line 47 def thumb_md s = '' if fphotos.count > 0 s = fphotos.first.image.thumb_md end s end |
#thumb_preview ⇒ Object
63 64 65 66 67 68 69 |
# File 'app/models/c80_news/fact.rb', line 63 def thumb_preview s = '' if fphotos.count > 0 s = fphotos.first.image.thumb_preview end s end |
#thumb_sm ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/models/c80_news/fact.rb', line 39 def thumb_sm s = '' if fphotos.count > 0 s = fphotos.first.image.thumb_sm end s end |