module JamRuby
  class RecordingComment < ActiveRecord::Base
    include HtmlSanitize
    html_sanitize strict: [:comment]

    self.table_name = "recordings_comments"

    self.primary_key = 'id'

    default_scope { order('created_at DESC') }

    belongs_to :recording, :class_name => "JamRuby::Recording", :foreign_key => "recording_id"
    belongs_to :user, :class_name => "JamRuby::User", :foreign_key => "creator_id"

    validates :comment, length: {maximum: 1000}, no_profanity: true
  end
end