I wrote up quite a beefy post with some thoughts on delegate_types and improving the API.
I like writing these, but is this the kind of stuff you're all interested in?
https://kaspth.com/posts/making-rails-delegated_types-clearer
Freelance Ruby on Rails developer, writer, former stained-glass master (yup!).
I share what I learn about building software on http://remimercier.com. Swears a lot when nobody's watching.
🏳️⚧️ Trans lives matter
📝 Where I write | https://remimercier.com |
🔔 Get notified about new posts | https://remimercier.com/newsletter/ |
🙋🏻♂️ Hire me! | https://remimercier.com/work/ |
💖 Membership Program | https://github.com/sponsors/merciremi |
I wrote up quite a beefy post with some thoughts on delegate_types and improving the API.
I like writing these, but is this the kind of stuff you're all interested in?
https://kaspth.com/posts/making-rails-delegated_types-clearer
What is the root¹ issue with agentic AI? by @Mer__edith
¹ no pun intended I swear
@janpet @kaspth I've checked your questions, and the one I'm sure about is that:
Yes, you always have to initialize a Report (parent class) and a CoverSheet (child class). You can't just initilalize a child class on its own. I've tried it, doesn't work (well, you can make it work, but at what cost 😅).
I remember hitting a `ActiveRecord::HasManyThroughNestedAssociationsAreReadonly` but I can't remeber for the life of me how i solved this one.
@janpet I wrote about some of the pitfalls I encountered when working with DT in the past: https://remimercier.com/delegated-types/ It might help! Yell if it doesn't!
Also @kaspth just wrote something of his own here: https://kaspth.com/posts/making-rails-delegated_types-clearer More about making the API better, but it gives some good knowledge on the design.
Delegated types are a modelization pattern introduced in Rails in 2020. And developers have mostly been scratching their head for a few years trying to use them in their applications. Today, I want to share a real-world use case. I'll walk you through my pre-existing domain architecture, my initial requirements, my mistakes, how I eventually used delegated types, what I learned and my open questions.
The Herb Language Server is now also available in @zeddotdev in the latest version of the official Ruby extension!
Big thanks to @vitallium for maintaining the extension and making Ruby a very well supported language in Zed! 🙌🏼
https://fosstodon.org/@vitallium/114753586649431589