in the upgrading to 1.0.0. document, it could be a good idea to refer to the possibility to use dynamic fields. Instead of editing your models directly, you could just use
my_model[:_slugs] = array_of_old_slugs
def copy_slug(e)
slugs = []
if e[:slug_history] != nil
e[:slug_history].each do |h|
slugs << h unless (h == nil || h == "")
end
end
slugs << e[:slug]
e[:_slugs] = slugs
e.save
p " - #{e[:_slugs]}"
end
It should be noted that the order has relevance and the default slug will be the tail.
Another thing: I have embedded documents with slugs. Upon running
rake db:mongoid:create_indexes
MONGOID: Index: {:_slugs=>1}, Options: {:unique=>true}
MONGOID: Created indexes on Portfolio:
MONGOID: Index: {:_slugs=>1}, Options: {:unique=>true}
MONGOID: Index ignored on: PortfolioItem, please define in the root model.
PortfolioItem is embedded in Portfolio, so the index should be created there. How am I supposed to make Slug aware of this?