action cable
unknown
ruby
2 years ago
419 B
5
Indexable
class CommentsChannel < ApplicationCable::Channel def subscribed stream_for @question end end class QuestionsController < ApplicationController ..... def publish_comment return if @comment.errors.any? CommentsChannel.broadcast_to( @question, ApplicationController.render( partial: 'comments/show', locals: { comment: @comment } ) ) end ..... end
Editor is loading...
Leave a Comment