来自Gem的模型缺失 [英] Model from Gem is missing

查看:94
本文介绍了来自Gem的模型缺失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Rails 4应用程序中使用邮箱

  gem'邮箱'

我最近将它从 0.11 更新为 0.12.4 ,它停止工作,我不知道为什么。现在,我收到错误消息:

$ p $ 未初始化的常量消息

我检查了gem的 GitHub repo ,它确实有 Message 模型。



我检查了我的本地版本


  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.rb mailbox.rb消息.rb notification.rb receipt.rb


为什么不是我的找到模型的应用程序?如何解决这个问题?

解决方案

现在命名空间为 Mailboxer ::消息根据升级文档,在从0.11升级到0.12时,还需要执行几个步骤:

$ p $ rails生成mailboxer:namespacing_compatibility
rails生成mailboxer:install -s
rake db:migrate


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?

解决方案

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

这篇关于来自Gem的模型缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆