aboutsummaryrefslogtreecommitdiff
blob: 988f89057bd0498be6d747d86d62c9687b820711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)

  def new_answer_of(user)
    Answer.new :question_id => question_id, :owner => user
  end
end