我已尝试关注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
端