-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add mongo2mongo to add missing slugs to db
- Loading branch information
1 parent
e5279ef
commit 738850a
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|