remove duplicate code

This commit is contained in:
wvengen 2013-06-14 01:39:30 +02:00
parent 13f2c128c6
commit 8141ad0233

View file

@ -106,16 +106,6 @@ class Ordergroup < Group
end end
end end
# Make sure, the name is uniq, add usefull message if uniq group is already deleted
def uniqueness_of_name
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
errors.add :name, message
end
end
# Make sure, the name is uniq, add usefull message if uniq group is already deleted # Make sure, the name is uniq, add usefull message if uniq group is already deleted
def uniqueness_of_name def uniqueness_of_name
id = new_record? ? nil : self.id id = new_record? ? nil : self.id