fixed postgres syntax in rails style