Sha256: 37fe2664a13bd403e34163d1a06cbecf14d86b17ebe85e061e8e173f7aa13115
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
require_dependency 'spam_protection' class Trackback < Content include TypoGuid belongs_to :article, :counter_cache => true content_fields :excerpt validates_age_of :article_id validates_against_spamdb :title, :excerpt, :ip, :url validates_presence_of :title, :excerpt, :url validate_on_create :article_is_pingable def self.default_order 'created_at ASC' end def initialize(*args, &block) super(*args, &block) self.title ||= self.url self.blog_name ||= "" end def location(anchor=:ignored, only_path=true) blog.url_for(article, "trackback-#{id}", only_path) end protected before_create :make_nofollow, :process_trackback, :create_guid def make_nofollow self.blog_name = blog_name.strip_html self.title = title.strip_html self.excerpt = excerpt.strip_html end def process_trackback if excerpt.length >= 251 # this limits excerpt to 250 chars, including the trailing "..." self.excerpt = excerpt[0..246] << "..." end end def article_is_pingable return if article.nil? unless article.allow_pings? errors.add(:article, "Article is not pingable") end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
typo-3.99.0 | app/models/trackback.rb |
typo-3.99.2 | app/models/trackback.rb |
typo-3.99.3 | app/models/trackback.rb |
typo-3.99.1 | app/models/trackback.rb |