Alabhya Jindal

My thoughts on Rails

I have been thinking about Rails recently - how excited I was before learning it and how disappointed I am now.

I wanted to learn Rails again last year after not being successful the first time. I thought this time I’ll structure my learning and learn Ruby before Rails. That was a great decision.

I spent a month learning and writing Ruby. Small programs and coding challenges mostly. I also started working on a gem but abandoned it. I wanted to start learning Rails.

The first month of learning Rails was smooth-sailing. I found my experience moving from Node to Rails very similar to Niko’s.

Positives

I am actually too fired up right now to talk about the positives. But broadly.

Negatives

There is too much emphasis on convention in Rails. People immersed in the ecosystem don’t see this problem. I am going to bring up some specific issues now.

JavaScript

Rails is anti JavaScript. That’s how it feels like given how difficult it is to write JavaScript on the client side. Or to use NPM packages. It’s against build steps, which would have been fine - if Import Maps didn’t suck this bad. I had a hard time writing JavaScript code for a .html.erb file. I wanted to include a <script> tag in the view and have that JavaScript only load for that view. I gave up trying to do this. Turns out there’s a better way of doing whatever I wanted to do. The Rails way! Hotwire.

Hotwire

Hotwire is Rails answer to SPA style fluid navigation and updates to the screen without page reloads. It does this by replacing parts of the screen with HTML returned by the server. I love this idea. I hate how Hotwire implements it.

htmx implements this idea very well and it’s backend agnostic (which Hotwire also claims to be but you’ll be non-intelligent to want to use it outside Rails since people can’t get it to work in Rails itself).

I was working on a Hacker News clone to practice my Rails skills. And I wanted to make a post request to upvote an item and update the UI without reloading the page.

The Hotwire documentation is a mess. My best bet was copy pasting code from LLMs because I didn’t want to spend a week learning Rails conventions. That didn’t work. And I gave up on using Hotwire.

Conclusion

Developers today are not willing to spend many months learning the intricacies of a framework. Experienced Rails developers might say that you don’t need to. And that you can ship a MVP faster in Rails. No. Wrong. You feel that because you have worked with it for a long time.

I feel that I wouldn’t be so frustrated with Rails if I just approached it without the high expectations of it being world changing. And realizing that it’s just another framework with it’s own prons and cons.