I'm trying to validate wether a Model.category equals any existing Category name
unless Category.exists?(:name => self.category.downcase)
I had to put downcase in this to ensure all of them were downcased so they could match up as strings. But its a big server hit to update the attribute before_save, and I was thinking of just matching them via regexp. Something like this
unless Category.exists?(:name => /#{self.category}/ }
Is there something like that possible? Or is there a better way to do this?