All threads / Best approach for combining Rails and Javascript

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Best approach for combining Rails and Javascript

Ryan Steen asked in Javascript

So I am fairly new to rails dev. I have built several small apps in rails and javascript. There is such much chatter about different frameworks. I am wondering what the best approach would be to incorporate javascript into rails projects. I know Laravel has incorporated Vue out of the box. Is rails leaning in any specific direction. Would it be best to take the time and just learn to incorporate Vue, React or another framework? When do those additions really become neccessary? There are so many options it can be difficult to decide on a direction.

Hey Ryan,

These are great questions, and everyone's probably going to give a slightly different answer.

Rails really has tried to avoid answering that question. Basecamp (who created Rails) doesn't use a framework, and doesn't generally build anything super Javascript heavy, so they just write plain Javascript.

I've really enjoyed using Vue.js myself and know that the Laravel community has too. I've done several videos on this which you can see here: https://gorails.com/series/using-vuejs-with-rails (there might be some others not in this series).

I generally try to work without a framework if my application is simple. GoRails, for example, doesn't have much Javascript at all and therefore I'd rather just write plain JS. For something more complex that might use websockets or be much more interactive (like Trello for example) then a JS framework really starts to make sense.

A new series I'm starting shortly is going to be building a Trello clone with Vue.js which might answer some of these questions for you too. That should begin in the next week or two.

There is a Rails based Trello clone available on GitHub https://github.com/somlor/kanban .

Thanks! I will check it out.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 34,885+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.