在我的应用程序;当我提交表单,我得到这个错误:LoadError无法自动加载常量消息
LoadError at /questions
Unable to autoload constant Message, expected /app/models/message.rb to define it
它指向的Questions
控制器create
行动:
@message = current_user.messages.new(:subject => "You have a question from #{@question.sender_id}"`
消息模型:
class Mailboxer::Message < ActiveRecord::Base
attr_accessible :notification_id, :receiver_id, :conversation_id
end
它看起来像一个命名空间问题。用户和消息之间的关系如何定义,“Message”模型定义在哪里? – Sharagoz
@Sharagoz如果我从名称中删除了'Mailboxer ::',我得到错误'表'dating_development.messages'不存在'。这是有道理的,因为没有消息表,只有通知表。我只是意识到'Mailboxer :: Message'应该进入子目录,但如果我开始沿着这条路走下去,那么我会走错路。 – pwz2000
你可以在问题中分享'用户'模型吗? –