Skip to content

Instantly share code, notes, and snippets.

@alg
Created December 21, 2010 08:08
Show Gist options
  • Save alg/749649 to your computer and use it in GitHub Desktop.
Save alg/749649 to your computer and use it in GitHub Desktop.
No underscore/dash escaping in Mongoid
# Disables converting '-' and '_' into '-dash-' and '-undscr-' during composite key generation
class String
def identify
if Mongoid.parameterize_keys
key = ""
each_char { |c| key += ((c != '_' && c != '-' && CHAR_CONV[c]) || c.downcase) }; key
else
self
end
end
end
@airy
Copy link

airy commented Jun 3, 2011

only this version (https://gist.github.com/749649/87ae99a47430846d2854aae63192d4704c423b71) working properly for turkish charset ( Öö Çç Üü Şş Iı İi Ğğ)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment