Skip to main content

ActionCable in JumpStart project

Rails • Asked by Stefan Dippl

Hi!

Is there anything special I need to consider when using ActionCable in a project created with the JumpStart template?

I've followed several tutorials (e.g. "Action Cable ‘Hello World’ with Rails 5.1") about ActionCable, which work fine by themselves, but I can't transfer that learned knowledge in my JumpStart based project.

I'm mostly confused about the extra javascript folder in the /app folder (vs. /app/assets). None of my coffee scripts in /app/assets/javascript/channelscreated by the rails generator get initialized. Also I don't see the /cable route getting started.

It would be great if someone could point me in the right direction or give me the most simple example of how to work with ActionCable in a JumpStart based project as I assume this can't be very hard.

Thanks in advance,
Stefan


Hey Stefan!

Everything is basically exactly the same, except that your Javascript is now in app/javascript instead.

The easiest way to setup a channel is just to run the rails generate for it:

rails g channel MyChannel

And it will take care of creating the files for you.

You can read about the JS stuff here in the edge guides:
https://edgeguides.rubyonrails.org/action_cable_overview.html#client-side-components


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.