blob: 7c4b78f54ad9d7afb827bdfdfdb9596bcedb7cdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# Questions are arranged in categories. Recruit should answer question in some
# categories.
class QuestionCategory < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
name :string, :null => false
timestamps
end
validates_presence_of :name
has_many :questions
has_many :user_categories
has_many :users, :through => :user_categories, :accessible => true
include Permissions::AnyoneCanViewAdminCanChange
# Array of arrays [Category name, Category id], includes also
# ['All Categories', nil] array.
def self.as_select_opts
[['All Categories', nil]] + QuestionCategory.all(:select => 'name, id').collect{ |q| [q.name, q.id]}
end
end
|