126 points · by colinbartlett · 11y ago · 36 comments
This gem was created because this feature was going to be in Rails a few years back, but was pulled out by DHH before release. But, as you can see, he's cool with it now.
I don't think this is a huge deal, but it will definitely be nice to have official support for this configuration.
EDIT: sorry, I mis-read your post. This is just "Why Rails and not Sinatra," not "this is easy enough to do on its own, why bother."
I wasn't directly involved in the decision, so I cant' tell you, to be honest.
Regardless, SPAs are fast becoming the best way to develop and this sort of thing (rather than the bandaid of turbolinks) gives me a lot of hope for the future of rails. I can even see rails eventually replacing views with a presenter layer (though something like that would probably wait for 6).
Reminds me of what someone once said about America: "they always do the right thing, after exhausting all other possibilities".
You could see this move towards JSON APIs way back in 2012 as I suggested here: http://paulbjensen.co.uk/posts/2012/07/11/thoughts-on-rails-....
Some poo-pooed the notion, but you can clearly see that the popularity of realtime frameworks and the way that apps are built client-side heavy is pulling Rails in this direction.
Performance is still the key factor here, and I suspect that's half the reason why you've got some people who espoused Ruby in the past now playing with other languages beginning with Ru, but that have a much less friendly syntax compared to Ruby.
Some welcome changes though nonetheless, especially on the WebSockets front.
I've down API dev in Rails too, but it really feels like killing a fly with a hammer sometimes. And as I shift strongly to microservices (thanks Docker!), I want my API code to be as minimalist as possible. Grape/Sequel feels simple, which is good.
Would love to see a few examples
> I've down API dev in Rails too, but it really feels like killing a fly with a hammer sometimes
More like creating a few extra layers of abstraction to confuse the fly.
If you want true stability you probably have to switch to a language with a stronger type system. That Sinatra bug proves that even small codebases can suffer from basic type errors.
Type systems don't eliminate all testing, but they do eliminate a large swath of possible errors that need to be tested for, like the one that has (had?) been afflicting Sinatra.