Sha256: 4999071c112ee02d2101f193b872651f380739342a8a8fb9a1e9fbd1627df350
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
# == Schema Information # # Table name: comments # # id :integer not null, primary key # post_id :integer # commentator_id :integer # commentator_type :string(255) # content :text # active :boolean default(TRUE) # approved :boolean default(FALSE) # reported :boolean default(FALSE) # ancestry :string(255) # created_at :datetime not null # updated_at :datetime not null # class Comment < ActiveRecord::Base belongs_to :post # belongs_to :article, :class_name => Article, :foreign_key => "article_id" belongs_to :commentator, polymorphic: true has_ancestry :orphan_strategy => :rootify scope :approved, where(:approved => true) scope :not_approved, where(:approved => false) scope :active, where(:active => true) scope :reported, where(:reported => true) scope :not_reported_and_active, where(reported: false, active: true) def title [self.article.title,self.content[0..20]].join(" - ") end def commentator_title if self.commentator.respond_to?(:title) self.commentator.title end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rdcms-1.0.28 | app/models/comment.rb |
rdcms-1.0.27 | app/models/comment.rb |
rdcms-1.0.26 | app/models/comment.rb |