some fixes to janitor trials, implemented jan trial controller test

This commit is contained in:
albert
2011-01-14 16:45:10 -05:00
parent dceda1b073
commit 3d5873c182
15 changed files with 206 additions and 29 deletions

View File

@@ -2,10 +2,15 @@ class UserFeedback < ActiveRecord::Base
set_table_name "user_feedback"
belongs_to :user
belongs_to :creator, :class_name => "User"
before_validation :initialize_creator, :on => :create
attr_accessible :body, :user_id, :is_positive
validates_presence_of :user_id, :creator_id, :body
validates_presence_of :user, :creator, :body
validate :creator_is_privileged
def initialize_creator
self.creator_id = CurrentUser.id
end
def creator_is_privileged
if !creator.is_privileged?
errors[:creator] << "must be privileged"