Fix for mysql database cause key is a reserved word
This commit is contained in:
parent
770f18ac50
commit
2d162ff9ac
|
@ -24,7 +24,7 @@ class Key < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def unique_key
|
def unique_key
|
||||||
query = Key.where('key = ?', key)
|
query = Key.where('`key` = ?', key)
|
||||||
query = query.where('(project_id IS NULL OR project_id = ?)', project_id) if project_id
|
query = query.where('(project_id IS NULL OR project_id = ?)', project_id) if project_id
|
||||||
if (query.count > 0)
|
if (query.count > 0)
|
||||||
errors.add :key, 'already exist.'
|
errors.add :key, 'already exist.'
|
||||||
|
|
Loading…
Reference in a new issue