From 7595c9b5a6620f0b7467950aa0068fd6e022995c Mon Sep 17 00:00:00 2001 From: hidakatsuya Date: Thu, 31 Jul 2014 20:54:54 +0900 Subject: [PATCH] Fixed #4 Reset the default query if project is not the current project --- app/models/projects_default_query.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/projects_default_query.rb b/app/models/projects_default_query.rb index 3f8eb2d..b437105 100644 --- a/app/models/projects_default_query.rb +++ b/app/models/projects_default_query.rb @@ -16,8 +16,11 @@ def query default_query = super return unless default_query - if !new_record? && !default_query.public_visibility? - update_attribute :query_id, nil + unless new_record? + unless default_query.public_visibility? && + default_query.project == project + update_attribute :query_id, nil + end end default_query end