Chada
Chada

Reputation: 63

uninitialized constant Mongoid::Taggable::Mongo

I added mongoid-taggable to my Gemfile and then added include Mongoid::Taggable in my model, but received an error message:

uninitialized constant Mongoid::Taggable::Mongo

Error trace:

app/models/recipe.rb:13:in `include'
app/models/recipe.rb:13:in `<class:Recipe>'
app/models/recipe.rb:2:in `<top (required)>'
app/controllers/recipes_controller.rb:11:in `index'

Does anyone have a solution to this problem?

Upvotes: 3

Views: 581

Answers (1)

janders223
janders223

Reputation: 3153

Without digging too much into the source of Mongoid Taggable, my guess would be that it was built for a 2.x.x version of Mongoid. With the 3.x.x release of Mongoid, the dependency on the mongo gem was removed. It doesn't appear that anyone has committed to this gem in over a year, so I doubt that it has any support for a version 3.x.x of Mongoid.

If you are set on using this gem for tagging, you will need to roll back to an earlier release of Mongoid. 2.4.12 was the last stable release in the 2.x.x branch.

Another solution would be to use a different gem. I would recommend mongoid-tags-arent-hard. It is Mongoid 3 compatibile, and works fairly well.

Upvotes: 1

Related Questions