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.

Reply

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.

Reply

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

Reply

Thanks! I will check it out.

Reply
Join the discussion
Create an account Log in

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

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

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