Model from Gem is missing

空扰寡人 提交于 2020-01-16 17:31:26

问题


I am using mailboxer in my Rails 4 app.

gem 'mailboxer'

I recently updated it from 0.11 to 0.12.4, it stopped working, and I cant figure out why. Now, I am getting the error:

uninitialized constant Message

I checked the gem's GitHub repo and it does have the Message model.

I checked my local version of the gem and it matches up.

Puma:mailboxer Jeff$ pwd
/Users/Jeff/.rvm/gems/ruby-2.0.0-p247/gems/mailboxer-0.12.4/app/models/mailboxer
Puma:mailboxer Jeff$ ls
conversation  conversation.rb mailbox.rb  message.rb  notification.rb receipt.rb

Why isn't my app finding the model? How do I fix this?


回答1:


Message is now namespaced as Mailboxer::Message. According to the upgrade documentation, you also need to run through a few steps when upgrading from 0.11 to 0.12:

rails generate mailboxer:namespacing_compatibility
rails generate mailboxer:install -s
rake db:migrate


来源:https://stackoverflow.com/questions/25756678/model-from-gem-is-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!