aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user_category.rb')
-rw-r--r--app/models/user_category.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/user_category.rb b/app/models/user_category.rb
index 3f60283..e4b8b51 100644
--- a/app/models/user_category.rb
+++ b/app/models/user_category.rb
@@ -28,9 +28,9 @@ class UserCategory < ActiveRecord::Base
end
belongs_to :user, :null => false
- belongs_to :question_category, :null => false
+ belongs_to :category, :null => false
- validates_uniqueness_of :user_id, :scope => :question_category_id
+ validates_uniqueness_of :user_id, :scope => :category_id
multi_permission :create, :update, :destroy do
return true if acting_user.role.is_recruiter?
@@ -48,7 +48,7 @@ class UserCategory < ActiveRecord::Base
end
def before_create
- for group in QuestionGroup.unassociated_in_category(user, question_category).all
+ for group in QuestionGroup.unassociated_in_category(user, category).all
chosen_question = rand(group.questions.count)
UserQuestionGroup.create! :user => user, :question =>
(Question.all :limit => 1, :offset => chosen_question, :conditions => {:question_group_id => group.id})[0]