mardi 24 novembre 2015

save name as an unique without change its current case

we have an issue for validation unique column creation

The problem is we have already one field name "Stack Overflow"

Now I am able to check if some one put "Stack Overflow" or "STACK OVERFLOW" or "stack overflow" we don't allow user to create that field.

But when some one put more space between "Stack Overflow" it saves with space it saves with that space so it don't check uniqueness of field.

we are using this code for unique column check

self.unique_columns = self.unique_columns + additional_unique_columns.each_line.collect(&:strip).map(&:downcase).uniq.select{|column| !self.unique_columns.map(&:downcase).include?(column.downcase)}

Can anyone suggest how we can check this type of scenario.

Aucun commentaire:

Enregistrer un commentaire