diff --git a/time/app/models/time_entry.rb b/time/app/models/time_entry.rb index a8c542a90..513652911 100644 --- a/time/app/models/time_entry.rb +++ b/time/app/models/time_entry.rb @@ -17,7 +17,7 @@ class TimeEntry < ActiveRecord::Base def validate errors.add :hours, :activerecord_error_invalid if hours && hours < 0 errors.add :project_id, :activerecord_error_invalid if project.nil? - errors.add :issue_id, :activerecord_error_invalid if issue && project!=issue.project + errors.add :issue_id, :activerecord_error_invalid if (issue_id && !issue) || (issue && project!=issue.project) end def spent_on=(date)