refactoring according to Alexander's comments

This commit is contained in:
Vokhmin Alexey V 2014-04-11 00:09:02 +04:00
parent 5102e8bd86
commit 43fc57ec37
1 changed files with 2 additions and 4 deletions

View File

@ -217,10 +217,8 @@ class Ability
] ]
end end
def read_relations_with_projects(table = nil) def read_relations_with_projects(table = 'projects')
key = table ? 'project_id' : 'id' key = table == 'projects' ? 'id' : 'project_id'
table ||= 'projects'
["#{table}.#{key} = ANY ( ["#{table}.#{key} = ANY (
ARRAY ( ARRAY (
SELECT target_id SELECT target_id