News for hackers. Stuff that matters.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by brntsllvn on Tuesday December 20, 2022 @10:26AM (#34067175)
I was a devoted rails fan 10 years ago, but haven't looked back since full stack typescript.

What's the general vibe on RoR nowadays?

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by kshahkshah on Tuesday December 20, 2022 @10:38AM (#34067368)
I love TypeScript, but Rails has a wonderful ecosystem of libraries that just feels unbeatable for the backend. For some reason (hot take incoming) the JS community seems to hate working with each other and improving existing libraries. The Ruby community seems to rally around improving our libraries (gems) rather than reinventing them every year.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by stevebmark on Tuesday December 20, 2022 @11:20AM (#34068033)
I take it you’ve never tried to install nokogiri?
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by Mikeb85 on Tuesday December 20, 2022 @11:29AM (#34068177)
It's been fine for years now.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by fknorangesite on Tuesday December 20, 2022 @11:28AM (#34068165)
I think this joke is five or six years out of date. Nokogiri has been a breeze to install for a long time now.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by dwheeler on Tuesday December 20, 2022 @12:01PM (#34068695)
I used nokogiri in Ruby on Rails in 2015 and since, and have never had a problem installing nokogiri.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by fknorangesite on Tuesday December 20, 2022 @01:12PM (#34069813)
Exactly. It did used to be pretty finicky, but yeah I think it was 2015ish that those issues were fixed.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by faizshah on Tuesday December 20, 2022 @11:22AM (#34068071)
I feel like this is not a hot take, the big problem with JS ecosystem is the lack of stability. Every JS developer seems ok with picking their 100 favorite packages for each project instead of rallying around some core packages that everyone works on. Personally I don’t like the TS approach for large monoliths because I don’t like having to pick each library a la carte. I do prefer Typescript’s gradual typing system, but Rails wins in being easy and quick for development.

The big difference between the Rails and Ember approach vs most framework communities is the shared community around a shared tech stack.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by ezekg on Tuesday December 20, 2022 @10:28AM (#34067201)
I use it daily for my company's API. It's still the most productive framework I've used, and I've used full stack Typescript too (i.e. the wild west).
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by brink on Tuesday December 20, 2022 @10:33AM (#34067279)
> What's the general vibe on RoR nowadays?

Most people that use it are fine and productive.

Because of lazy evaluation, type issues persist though. Plenty of instances of trying to call string methods on integers, and array methods on nil, and Rails devs in denial that that's a big problem as the app continues to grow.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by randomdata on Tuesday December 20, 2022 @10:45AM (#34067468)
Because of lazy evaluation or because the developers aren't properly documenting their work? A language with a formal type system essentially forces you to provide type documentation, but there is an expectation with dynamically typed languages that you will still document the types (probably in your test suite). Rails in particular makes this a core function of the framework to really push you to do so.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by pmontra on Tuesday December 20, 2022 @10:52AM (#34067577)
> Rails in particular makes this a core function of the framework to really push you to do so.

This sentence surprised me. How does Rails do it?

I never documented types in Rails and all was well, since 2005.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by randomdata on Tuesday December 20, 2022 @11:01AM (#34067742)
Rails puts testing front and centre. Testing exists to document how features are intended to function and intended to be used (with the added bonus of enabling machine validation of the documentation).

If a function accepts an arbitrary type, as is the case for all inputs in a dynamic language, one needs to document how the function is expected to behave when given x type. This is ultimately the same as type checking in a typed language. It just moves where the documentation is located.

In that move, it is true that you often lose some strictness in the quality of the documentation. The developers who have an active hatred towards their co-workers may even forgo writing documentation entirely. But if you reach that point you've really got people problems, not technical problems.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by endlessvoid94 on Tuesday December 20, 2022 @10:51AM (#34067560)
I don't think it's denial - I've worked on a ton of rails apps of all different sizes and scales and...I've gotta say, I just don't see the issues you name in production all that often.

It's a problem, but it's not a big problem.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by wiseowise on Tuesday December 20, 2022 @01:36PM (#34070190)
It’s not a big problem until it is.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by pizza234 on Tuesday December 20, 2022 @10:52AM (#34067575)
> Because of lazy evaluation, type issues persist though. Plenty of instances of trying to call string methods on integers, and array methods on nil, and Rails devs in denial that that's a big problem as the app continues to grow.

This is not anymore inherent in the language. Gradual typing support for Ruby is now reasonably mature (companies like Shopify with large codebases have adopted it), so it's up to the team do decide if they want to take advantage of it or not.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by flippinburgers on Tuesday December 20, 2022 @11:01AM (#34067736)
The main problem is active record insanity and poorly designed table relationships/indices that lead to maintenance nightmares.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by fknorangesite on Tuesday December 20, 2022 @11:53AM (#34068572)
> poorly designed table relationships/indices that lead to maintenance nightmares.

Like what?

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by theonething on Tuesday December 20, 2022 @12:38PM (#34069277)
> active record insanity

What exactly do you mean by that? It's just a bad ORM all around or is there something specific that is insane about it?

> poorly designed table relationships/indices

What does that have to do with Rails? Poorly designed databases are the fault of the developer(s) who designed them.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by Alifatisk on Tuesday December 20, 2022 @11:46AM (#34068451)
I have to agree on this one, it feels like some people are in denial of type issues within the Ruby / Rails community.

I've been experimenting with Rbs, Sorbet & Contracts though, they have their potential.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by gosukiwi on Tuesday December 20, 2022 @12:32PM (#34069178)
To be fair most of typing problems in Rails can be solved by having contracts and an operation pattern, kind of like Trailblazer, although they went a little bit too far lol
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by oleg_antonyan on Tuesday December 20, 2022 @12:48PM (#34069438)
The UX is terrible. Separate file for types is just inconvenient. I wish it was something like Python's optional typing
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by Alifatisk on Tuesday December 20, 2022 @02:19PM (#34070969)
Optional typing in Ruby would be so awesome
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by jack_riminton on Tuesday December 20, 2022 @12:17PM (#34068933)
For what it's worth I've been working with Rails projects for over 7-8 years and I've never encountered this as a problem
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by oleg_antonyan on Tuesday December 20, 2022 @12:46PM (#34069389)
I use type assertions for this https://github.com/olegantonyan/typerb
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by randito on Tuesday December 20, 2022 @02:03PM (#34070673)
> and Rails devs in denial that that's a big problem as the app continues to grow.

As someone who maintains Rails 3 apps ad infinitum, this is where things break down with Rails applications. You can create applications very quickly with Rails if you stay within the conventions. But as the app grows, that discipline breaks down and the structure starts to suffer.

This is true for a lot of web applications. But I think the problem is worse for Rails because it's so easy to get started and create apps. That ease comes back to bite you -- as a giant legacy Rails app that no one on the team understands and no one is interested in fixing or maintaining.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by multiplegeorges on Tuesday December 20, 2022 @04:56PM (#34073240)
I've just added Sorbet and Tapioca to a Rails project and I was pleasantly surprised to find out that it works very well now!

As I add type annotations to my methods, VS Code and Sorbet are giving me similar feedback to what I get from Typescript projects.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by throw_m239339 on Tuesday December 20, 2022 @10:41AM (#34067406)
Typescript itself isn't really "full stack", what frameworks are you using with Typescript? they are your stack. Rails is a framework, it's not a language.

I used Rails mainly in the past because I did plain web apps with very little Javascript on the client. Active Record was really handy to quickly develop the data access part of it. But more importantly, they were several books (like the Rails tutorial and others) with practical projects.

IMHO that's what matters the most with a framework, concrete examples, real world project tutorials and a very good documentation.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by angelmm on Tuesday December 20, 2022 @10:32AM (#34067261)
At the backend side, it makes easy to build websites. However, the UI layer is a bit complex to integrate with common framework libraries like Vue and React.

Although, I still use it in some projects :)

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by flakeoil on Tuesday December 20, 2022 @11:36AM (#34068299)
I'm not sure why you think it's difficult to integrate with Vue and React?

Maybe InertiaJS [0] would help.

[0] https://inertiajs.com/

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by iamveen on Tuesday December 20, 2022 @02:07PM (#34070760)
OMG thank you! So many times I've wished for a nice way to leverage React UI components within Rails without the nuisance of APIs, client-side state, etc. This appears to fit that bill nicely.

Are there any glaring reasons one would not want to use this library?

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by firecall on Wednesday December 21, 2022 @01:15AM (#34077299)
Would you use this instead of Hotwire?
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by DiNovi on Tuesday December 20, 2022 @10:42AM (#34067433)
what the heck is full stack typescript
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by texxtxxet on Tuesday December 20, 2022 @10:47AM (#34067497)
presumably the "programming language(s)" part of the stack never changes between front and back end (it's typescript)?
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by jcpst on Tuesday December 20, 2022 @01:54PM (#34070510)
Writing typescript code that compiles to javascript code that runs on a platform like node.js, and writing typescript code that compiles to javascript that run in a web browser.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by systems_glitch on Tuesday December 20, 2022 @10:54AM (#34067620)
Still using it, still highly productive. Not doing as much Rails work as I was 10 years ago but that's due to a change in the nature of my business. We still use it and Sinatra for the bulk of our Internet-facing and internal stuff.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by andrei_says_ on Tuesday December 20, 2022 @12:03PM (#34068734)
If you use Sinatra take a look at roda. It’s fast and elegant.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by systems_glitch on Tuesday December 20, 2022 @02:25PM (#34071066)
I've been meaning to, several people have recommended it to me!
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by chrisbaker98 on Tuesday December 20, 2022 @10:57AM (#34067661)
Switched to Elixir/Phoenix a few years ago and have never looked back. Absolutely a 100% improvement on Rails in every way (except the availability of work!)
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by bboylen on Tuesday December 20, 2022 @11:21AM (#34068042)
What is so nice about Elixir/Phoenix?

I understand that it is functional, which seems neat, but how does that translate into better app development?

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by jamie_ca on Tuesday December 20, 2022 @12:26PM (#34069083)
I don't have a lot of direct experience, but one of the big draws is that by running on top of OTP you get a lot of stuff for free that you'd otherwise need to hit external dependencies for. Caching and background job management that usually see you pull in Redis are the common call-outs.

Also, Phoenix LiveView is absolute voodoo magic the first time you experience it.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by pantulis on Tuesday December 20, 2022 @01:27PM (#34070044)
Also, performance is mind-blowing.

Still I am not really sure that the tradeoff makes it worth against non-FP frameworks a la Rails.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by dmak on Tuesday December 20, 2022 @11:20AM (#34068028)
Elixir is great. I love it!
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by jcpst on Tuesday December 20, 2022 @01:52PM (#34070461)
I revisited rails this past week for the first time in nearly 10 years. So much easier to quickly develop an app on than what I have been doing. I feel done with the whole SPA thing unless there's no other way to build the app.

But now I'm looking at performance, and memory usage, and phoenix looks very appealing from that side.

Now I think I should try pheonix, since both rails and phoenix are new to me, so I can compare.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by serverholic on Tuesday December 20, 2022 @11:10AM (#34067889)
I went from a full stack typescript project to a rails project and honestly I hate it.

The Ruby language is great if you want to jerk off about how concise your code is but programmers end up creating overly abstract, write-only code.

There’s so much magic that it’s hard to trace the code to see where stuff comes from.

Abstractions are over-engineered. Serializers should be simple, async functions that are easy to step through and debug. Instead you have serializer relations? Delegates, etc.

Don’t even get me started on updating rails itself. It’s a massive pain every time and you quite often see projects that are multiple major versions behind.

In typescript it’s common to integrate multiple independent libraries into your own framework. This is great because if I need to update my database library I can focus on that specific part of the code. Updating rails means everything could potentially break.

Oh and there’s no type system so good luck.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by mplewis on Tuesday December 20, 2022 @11:17AM (#34067981)
Rails is unfortunately much slower, and it’s quite coupled to the concepts of server-side rendering and OOP MVC. Making Rails work with a modern frontend feels pretty hacky compared to using a full-stack TypeScript framework.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by silversmith on Tuesday December 20, 2022 @12:04PM (#34068755)
I'll give you the slow, but "modern" frontend is a breeze. Webpacker (yes, the deprecated one, newer solutions are worse) handles React beautifully, and my graphql API definition gets seamlessly converted into typescript types. If anything, it often feels even easier than the code sharing I've experienced in node-land.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by samtheprogram on Tuesday December 20, 2022 @03:03PM (#34071680)
What are you using for GraphQL support in Rails? I was just looking into this yesterday.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by gls2ro on Wednesday December 21, 2022 @12:16AM (#34076948)
Because maybe other people might read this:

Rails are good enough to keep Shopify standing for another year of holiday sales. It seems to do that since 2006, so this alone demonstrates that Rails can support you a long way in your multi-billion business.

And if you think: "yes, but Shopify has a big talented team," I feel the need to say back, "Well, when you are at Shopify business size, you will have it too. And Shopify used it when they were small too."

I am not saying Rails fits everything, but if your business fits Rails, that is a great framework to build with.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by redox99 on Tuesday December 20, 2022 @11:28AM (#34068170)
What technologies exactly do you use in your full stack typescript?
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by ithrow on Tuesday December 20, 2022 @11:57AM (#34068628)
nodejs, postgres and react?
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by alexcosan on Tuesday December 20, 2022 @12:32PM (#34069174)
I would be curious to understand what frameworks people tend to use on top of nodejs (or even react). I have not found a standard devise-like way of implementing authentication in nodejs. The usual recommendation I come across is to develop all from scratch (encryption, emails, session management), using something like Passport, outsource it and pay to some third-party or use a framework like nextauth which is very opinionated and hard to change basic options. It's not uncommon to see people changing between ORM or SQL builders all the time because it's hard to find one that works greatly - it seems like a common discussion online in node communities.

I love TypeScript and would love to use it more extensively, but whenever I start a project, I quickly feel like I'm wasting so much time to do something that I'd hope a) it'd be very quick, and b) there would be some general agreement in the community on the right approach. It'd be great to compile what libraries to use, so you can very quickly put something together like you'd be able to do with Rails (e.g. devise, sidekiq, actionmailer, ...).

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by bambataa on Tuesday December 20, 2022 @11:42AM (#34068390)
What are you using for full stack Typescript? I’m not aware of anything as batteries included as Rails.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by multiplegeorges on Tuesday December 20, 2022 @04:58PM (#34073269)
There isn't one. RedwoodJS or Blitz come closest, IMO.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by e12e on Wednesday December 21, 2022 @04:57AM (#34078660)
And maybe deno+fresh? https://fresh.deno.dev/
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by Alifatisk on Tuesday December 20, 2022 @11:54AM (#34068589)
Any link to what you refer as fullstack typescript?
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by andrei_says_ on Tuesday December 20, 2022 @12:01PM (#34068690)
I’ve never seen a more productive stack. Enables me to build complete apps as a single dev - which would take 2x-5x of the time and effort if using separate front end apps. Ruby makes me happy when I use it. Hotwire and Stimulus let me create front end interactions without a separate SPA. The ecosystem is mature and well maintained. Absolutely love it.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by jack_riminton on Tuesday December 20, 2022 @12:12PM (#34068851)
I second this sentiment exactly!
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by methehack on Tuesday December 20, 2022 @12:55PM (#34069550)
Rails is really a gift. It's so productive and works so great on teams because of the heavy conventions I think. And the ruby library ecosystem is insanely good. Libraries generally do what they say they're going to do and there are libraries for everything. I've wondered a lot about why this is. Heavy air time? Is there something about ruby?

Every now and then I try some new web app framework that catches my eye in some new language and it always seems like its just getting started compared to rails -- and, it is. Worth noting -- rails works great API only as well. I bet Django is pretty good by now too of course, but Rails is really a fantastic tool well suited to task.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by sergiotapia on Tuesday December 20, 2022 @12:38PM (#34069278)
I recently tried Nextjs and Remix to explore other stacks since I've been using Elixir and Phoenix since 2016.

You won't find the dev UX you take for granted in Elixir and Phoenix.

Endless routing options, background jobs? Just install Squirrel and yadabadabadoo or just use AWS SQS(https://old.reddit.com/r/nextjs/comments/qspw4v/how_to_do_ba...). What about solid backend processes? Can I call those in some kind of repl? In Elixir I can just go `iex -S mix phx.server` and `MyModule.foobar("test")` and bada bing I'm all set. What about logging? Wait I need to decide and configure a logger? I also need to decide and configure what to output to? What about a nice ORM? Prisma looks good, set that whole thing up from scratch, I need to await, but special considerations need to be thought of when iterating through a collection? Promise.all vs for..of? I iterated an array and want to save it to the DB but it's running out of connections (https://github.com/prisma/prisma/discussions/16884)? Why do I even need to think about this?

Really curious to hear your counterpoints to this because granted I am quite new to backend typescript.

Re:Overview Of Upcoming Rails 7.1 Features Part 1 by melony on Tuesday December 20, 2022 @04:03PM (#34072514)
The counter argument is that you don't have to babysit any of those services. AWS/some other PaaS will handle everything for pennies. Unless you are working in a low cost of labor country, developer time is going to be more expensive than anything else. It will take very large scale/growth for infrastructure fees to exceed the total compensation of a decent US staff engineer or a site reliability engineering team.
Re:Overview Of Upcoming Rails 7.1 Features Part 1 by fomine3 on Wednesday December 21, 2022 @01:01AM (#34077226)
A problem is that "penny" isn't actually penny for hobby or very small internal in-corp project.