aboutsummaryrefslogtreecommitdiff
blob: 37540e2f72a185edeef960341281bd57e3e2891b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'permissions/inherit.rb'
class QuestionContentText < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    content HoboFields::MarkdownString, :null => false
    timestamps
  end

  belongs_to    :question, :null => false
  attr_readonly :question

  validates_length_of   :content, :minimum => 2

  inherit_permissions(:question)

  # Returns new answer (of proper class) of user for question (relation).
  def new_answer_of(user)
    Answer.new :question_id => question_id, :owner => user
  end
end