Skip to content
digitalplaywright edited this page Oct 23, 2012 · 2 revisions
class UpdateSlugs < Mongoid::Migration
  def self.up
    posts = Post.where(:slug.exists => true).only(:slug)
    posts.each {|p| p.set("_slugs", p["slug"]}
    Post.where(:slug.exists => true).unset(:slug)
  end

  def self.down
  end
end
Clone this wiki locally