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
def read_relations_with_projects(table = nil)
key = table ? 'project_id' : 'id'
table ||= 'projects'
def read_relations_with_projects(table = 'projects')
key = table == 'projects' ? 'id' : 'project_id'
["#{table}.#{key} = ANY (
ARRAY (
SELECT target_id