Skip to content

Commit

Permalink
add mongo2mongo to add missing slugs to db
Browse files Browse the repository at this point in the history
  • Loading branch information
burningTyger committed Aug 25, 2013
1 parent e5279ef commit 738850a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions mongo2mongo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# encoding: UTF-8
if ARGV[0]
require 'mongo_mapper'
require 'unicode'
require 'babosa'

MongoMapper.database = ARGV[0]

class Lemma
include MongoMapper::Document
key :lemma, String, :unique => true, :required => true, :index => true
key :slug, String, :unique => true
end

Lemma.find_each do |l|
l.set :slug => l.lemma.to_slug.clean.normalize(:transliterate => :german)
end
end

0 comments on commit 738850a

Please sign in to comment.