do not use string values for integers (closes foodcoops/foodsoft#128)

This commit is contained in:
wvengen 2013-06-14 01:33:56 +02:00
parent ca9841dd02
commit 13f2c128c6
2 changed files with 3 additions and 3 deletions

View file

@ -108,7 +108,7 @@ class Ordergroup < Group
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
def uniqueness_of_name
id = new_record? ? '' : self.id
id = new_record? ? nil : self.id
group = Ordergroup.with_deleted.where('groups.id != ? AND groups.name = ?', id, name).first
if group.present?
message = group.deleted? ? :taken_with_deleted : :taken
@ -118,7 +118,7 @@ class Ordergroup < Group
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
def uniqueness_of_name
id = new_record? ? '' : self.id
id = new_record? ? nil : self.id
group = Ordergroup.where('groups.id != ? AND groups.name = ?', id, name).first
if group.present?
message = group.deleted? ? :taken_with_deleted : :taken

View file

@ -82,7 +82,7 @@ class Supplier < ActiveRecord::Base
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
def uniqueness_of_name
id = new_record? ? '' : self.id
id = new_record? ? nil : self.id
supplier = Supplier.where('suppliers.id != ? AND suppliers.name = ?', id, name).first
if supplier.present?
message = supplier.deleted? ? :taken_with_deleted : :taken