Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 450
Chada Avatar asked Mar 27 '26 08:03

Chada


1 Answers

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.

like image 124
janders223 Avatar answered Mar 29 '26 22:03

janders223