wilkerlucio/mongoid_taggable

compatibility with moped and mongoid 3.0.1

Closed this issue · 1 comments

Hello,
I'm going through a total upgrade (mongoid 3.0.1, and rails 3.2.x) Model.tags no longer works because Mongoid switched to using Moped.

The current issue in mongoid_taggable is with the tags_index_collection method where it creates a new collection:

    def tags_index_collection
      @@tags_index_collection ||= Mongoid::Collection.new(self, tags_index_collection_name)
    end

I haven't yet figured out what the new way to create a collection in mongoid is.

Wondering if anyone else has run into issues and if so, how would you fix this?

Any help is much appreciated1

Kurt from MongoHQ helped me figure this out! the key was this:

def tags_index_collection
  @@tags_index_collection ||= Moped::Collection.new(self.collection.database, tags_index_collection_name)
end