Sha256: 4166f130daf71340d0489d92a6bb9c34ccf80f0c8ff36602cc767a77dfe9ae1b

Contents?: true

Size: 496 Bytes

Versions: 9

Compression:

Stored size: 496 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, uniqueness: 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

9 entries across 9 versions & 1 rubygems

Version Path
rostra-0.3.6 app/models/comment.rb
rostra-0.3.5 app/models/comment.rb
rostra-0.3.4 app/models/comment.rb
rostra-0.3.3 app/models/comment.rb
rostra-0.3.2 app/models/comment.rb
rostra-0.3.1 app/models/comment.rb
rostra-0.2.1 app/models/comment.rb
rostra-0.2.0 app/models/comment.rb
rostra-0.1.26 app/models/comment.rb