Rate#for should handle invalid projects. #1920

This commit is contained in:
Eric Davis committed 2009-01-16 16:43:26 -08:00
1 parent 08b267741b
commit 94e8aad493
2 files changed
+10

No files matched your search

+3
View File
@@ -26,7 +26,10 @@ class Rate < ActiveRecord::Base
# API to find the Rate for a +user+ on a +project+ at a +date+
def self.for(user, project = nil, date = Date.today.to_s)
# Check input since it's a "public" API
return nil unless user.is_a?(User)
return nil unless project.nil? || project.is_a?(Project)
rate = self.for_user_project_and_date(user, project, date)
return nil if rate.nil?