9
9
9karamba2019-04-24 14:50:19
Ruby on Rails
9karamba, 2019-04-24 14:50:19

How to redirect to root_url when passing to ActionCable: event: render_event(@event)?

def create
     ...
       ActionCable.server.broadcast "room_channel_user_#{user.id}",
                               event: render_event(@event)
     ...
end

When ActionCable is called, render (render_event) is triggered, and I need the page to show all events (ie root_url) after create.
How to make a redirect? I need render_event for output. Or maybe it's possible to somehow display it differently without the help of render_event (but so that it was also beautiful)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
9
9karamba, 2019-04-29
@9karamba

Issue resolved with render_to_string

V
Vayladion Gognazdiak, 2019-04-25
@etspring

Ebash from the WS client side document.location.href="ya_u_mamki_pogramist.ru";
In render_event, you probably have json, so instead of rendering, AMS master ala MyJerkedSerializer.new(@event)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question