Commit 9f1a5f415a306261d7c6b66f3a4ca7f062e914a8

Authored by Dmitriy Zaporozhets
1 parent 2d162ff9

Key uniq method refactored

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/key.rb
... ... @@ -24,7 +24,7 @@ class Key < ActiveRecord::Base
24 24 end
25 25  
26 26 def unique_key
27   - query = Key.where('`key` = ?', key)
  27 + query = Key.where(:key => key)
28 28 query = query.where('(project_id IS NULL OR project_id = ?)', project_id) if project_id
29 29 if (query.count > 0)
30 30 errors.add :key, 'already exist.'
... ...