aboutsummaryrefslogtreecommitdiff
blob: d6b57230b9d9ee240c73a54d8cdd997b6bf22c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class QuestionCategory < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    name :string
    timestamps
  end

  validates_presence_of :name

  has_many :questions
  has_many :user_categories
  has_many :users, :through => :user_categories, :accessible => true
  include Permissions::AnyoneCanViewAdminCanChange

  def self.as_select_opts
    [['All Categories', nil]] + QuestionCategory.all(:select => 'name, id').collect{ |q| [q.name, q.id]}
  end
end