Sha256: 791497781c92c217cccbc61f40acf1a86ffbfad0fecf23c05612f504b9e4ded6

Contents?: true

Size: 487 Bytes

Versions: 6

Compression:

Stored size: 487 Bytes

Contents

class Comment < ActiveRecord::Base

  include ActsAsCommentable::Comment
  include Rostra::EmailNotifier
  include Rostra::TimestampObserver

  belongs_to :commentable, :polymorphic => true
  belongs_to :user

  validates :comment, :presence => true
  validates_presence_of :user_id, :commentable_type, :commentable_id

  default_scope :order => 'created_at ASC'

  def question
    commentable.question if commentable.is_a?(Rostra::Answer)
  end

  alias_attribute :text, :comment

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rostra-0.1.25 app/models/comment.rb
rostra-0.1.24 app/models/comment.rb
rostra-0.1.23 app/models/comment.rb
rostra-0.1.22 app/models/comment.rb
rostra-0.1.21 app/models/comment.rb
rostra-0.1.20 app/models/comment.rb