未定义的方法`after_create_commit'留言:分类您的意思是? after_create - Rails动作电缆教程

时间:2017-12-27 18:32:06

标签: ruby-on-rails

我已尝试关注ActionCable tutorial - Site point并将本教程转换为使用MongoDB。但我有设计问题

NoMethodError in Devise::RegistrationsController#create

undefined method `after_create_commit' for Message:Class Did you mean? after_create

我对这个问题没有任何想法。请帮帮我,非常感谢你。

message.rb

class Message
 include Mongoid::Document
 field :body, type: String

belongs_to :user
belongs_to :chat_room

validates :body, presence: true, length: {minimum: 2, maximum: 1000}

after_create_commit { MessageBroadcastJob.perform_later(self) }

def timestamp
    created_at.strftime('%H:%M:%S %d %B %Y')
end

0 个答案:

没有答案