aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-06-05 22:10:07 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-06-08 21:57:19 +0200
commit9813d1b03a62d3ccf42ee1d0584b8a923215c98e (patch)
treece19a81f33240d5d467265506b5889c7453f22c2 /app/models/answer.rb
parentMake sure user isn't assigned to one category many times. (diff)
downloadrecruiting-webapp-9813d1b03a62d3ccf42ee1d0584b8a923215c98e.tar.gz
recruiting-webapp-9813d1b03a62d3ccf42ee1d0584b8a923215c98e.tar.bz2
recruiting-webapp-9813d1b03a62d3ccf42ee1d0584b8a923215c98e.zip
Mark answer as unapproved if content was changed
Diffstat (limited to 'app/models/answer.rb')
-rw-r--r--app/models/answer.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/answer.rb b/app/models/answer.rb
index da3a508..76fc37d 100644
--- a/app/models/answer.rb
+++ b/app/models/answer.rb
@@ -18,6 +18,10 @@ class Answer < ActiveRecord::Base
owned_model owner_class = "User"
+ before_validation do |record|
+ record.approved = false if record.content_changed?
+ end
+
multi_permission :update, :destroy do
(owned? && !reference && !approved) ||
(reference && acting_user.role.is_recruiter?) ||