Sha256: 5c5dc2a6708d52702ec023c812b938a2267cf134726cacff214ff16058844d4a
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
require "babosa" include ActionView::Helpers::SanitizeHelper module C80News class Fact < ActiveRecord::Base has_many :fphotos, :dependent => :destroy accepts_nested_attributes_for :fphotos, :reject_if => lambda { |attributes| !attributes.present? }, :allow_destroy => true validates_with FactValidator default_scope {order(:created_at => :desc)} extend FriendlyId friendly_id :title, use: :slugged def normalize_friendly_id(input) input.to_s.to_slug.normalize(transliterations: :russian).to_s end def slug_candidates [:title] + Array.new(6) {|index| [:title, index+2]} end def short_meta_description if description.present? && description.length > 200 result = description elsif full.present? && full.length > 0 result = strip_tags(full[0..200]+"...") else result = nil end result end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
c80_news-0.1.0.7 | app/models/c80_news/fact.rb |
c80_news-0.1.0.6 | app/models/c80_news/fact.rb |
c80_news-0.1.0.5 | app/models/c80_news/fact.rb |