fixes "undefined method `id' for nil:NilClass: searching model "dmsf_files""

seems sometimes dmsf_file.project is nil
This commit is contained in:
William Schey 2014-02-06 19:35:42 +10:00
parent e94676b6a4
commit 86829597b6

View File

@ -353,7 +353,11 @@ class DmsfFile < ActiveRecord::Base
if x.is_a?(ActiveRecord::Relation)
project_included = x.first.id == dmsf_file.project.id
else
project_included = x[:id] == dmsf_file.project.id
if dmsf_file.project
project_included = x[:id] == dmsf_file.project.id
else
project_included = false
end
end
end
end