11 ms·
Rails 6.1
- deleted 6y ago[deleted]
- bleonard 6y agoIt's cool to see "DHH" still in these changelogs.
- sbuccini 6y agoLots of good stuff in here, including much more support for using UUIDs as PKs. My favorite new feature is "delegated type" in ActiveRecord to offer a new way to map class hierarchies onto database tables. I wrote a blog post about it[0], but the actual PR is very readable as well[1]. [0] https://www.stevenbuccini.com/how-to-use-delegate-types-in-rails-6-1 https://www.stevenbuccini.com/how-to-use-delegate-types-in-r... [1] https://github.com/rails/rails/pull/39341 https://github.com/rails/rails/pull/39341
- polutropos 6y agoDoes a "delegated type" work with preloading associations, ala "includes"? This remains a pain point with many polymorphic associations in Rails, but not sure how the new functionality handles if, if it does at all.
- sbuccini 6y agoBased on this GitHub comment[0], it appears the answer is yes although it requires a little additional customization out of the box to prevent N+1 queries.. [0] https://github.com/rails/rails/pull/39341#issuecomment-727252082 https://github.com/rails/rails/pull/39341#issuecomment-72725...
- inopinatus 6y agoIn conjunction with Rails's "russian-doll" caching, N+1 queries are (or at least, can be) a good thing. This sounds counterintuitive; but, in the common case of read-heavy services, N ≐ 0 after the first access. When something changes, subsequent views end up loading & rendering the one record that changed, instead of preloading an entire collection. However, achieving this in practice requires some care in the nesting of view partials and records. c.f. DHH in https://www.youtube.com/watch?v=ktZLpjCanvg&t=4m27s https://www.youtube.com/watch?v=ktZLpjCanvg&t=4m27s "N+1 is a feature"
- sinsterizme 6y agoHey, just wanted to thank you for the link. This sent me down a deep rabbit-hole of DHH interviews! I'm surprised I haven't taken notice of him before, he has so many profound insights. I am really grateful :)
- inopinatus 6y agoYou're welcome. I think he's a deceptively clear thinker, by which I mean, DHH tends to supply a correct and insightful answer without discussing all the potentially wrong ones, or even unpacking all the insights contained within. It's left as an exercise for the student to realise how any particular "road not taken" would've been inconsistent with Rails's underlying principles. I don't mind that, since I've chosen to infer an assumption that we're all as smart as he is. (even if it does then take me years to explain things to myself...) If you didn't find it already, his "On Writing Software Well" video series is a fascinating, and sadly abbreviated, journey into his own application code.
- sinsterizme 6y agoBrilliant, I actually had not found that, thanks for the recommendation once again!
- skipants 6y agoSeems really nice. It's just a Rails abstraction for Multi-table inheritance (MTI) but to me that was sorely needed. MTI always felt much more manageable to me than Single-table inheritance but the latter was the only one with built-in support in Rails, until now.
- tomca32 6y ago> Lots of good stuff in here, including much more support for using UUIDs as PKs. I missed this. Going through the changelogs the only thing I found is support case-insensitivity for pg UUID types. Is that what you meant? I really think that not supporting UUID PKs is one of biggest issues with Rails. You can go around it and maybe even use a gem for it, but that's still a bit risky.
- ilikepi 6y agoWe implemented something like this on our own. We have child classes that inherit from an AR-backed parent, and on the parent we implement an instance method that transforms it (via #becomes) to the appropriate child based on the value of an attribute. The final piece is another attribute that stores a serialized object of child-specific attributes, and other methods that dynamically define attribute readers at boot time. It'll be nice to migrate to this new feature to free ourselves from the burden of that last piece in particular.
- _gtly 6y agoThe beginning of Horizontal Sharding support is great to see. More refined release notes here: https://edgeguides.rubyonrails.org/6_1_release_notes.html https://edgeguides.rubyonrails.org/6_1_release_notes.html And yet more release notes: https://weblog.rubyonrails.org/2020/12/9/Rails-6-1-0-release/ https://weblog.rubyonrails.org/2020/12/9/Rails-6-1-0-release...
- mhoad 6y agoIt's a really nice time to be a Ruby / Rails developer. Rails itself has made some really nice improvements with this release and there is also the "NEW MAGIC" should be following in the next couple of days which is currently being sold as what Rails was to the back end, this will be to the front end. Ruby 3 is also just a few days away which brings optional type checking to helps add some additional structure to larger code bases. Then in the wider community you have projects like Hanami 2.0 looking to launch next year which aims to bring all of the structure of "clean architecture" approaches and best practices with the simplicity and expressiveness of Ruby.
- freehunter 6y agoMan I'm hoping NEW MAGIC is like Phoenix LiveView. As a Rails dev I started looking into the Elixir/Phoenix world just for LiveView but I don't really want to switch languages... I just want that new magic that LiveView offers. I know there are gems for Rails but I'd prefer if it was baked-in and officially supported.
- mhoad 6y agoDepending on your patience you can go and take a look at a real life implementation of it at https://app.hey.com https://app.hey.com since they enable source maps. What the actual developer facing API is going to look like however is another question. I do kind of worry that given how much is has been talked up by DHH in particular that it is going to struggle to live up to the hype. Either way, I am excited to see something new in the Rails front end space, that has felt like it was lacking a LOT of structure.
- inopinatus 6y agoI was sold on hey.com's UI design already because it's using <details><summary> for dropdown menus. The really fun part, though: the summary content isn't just a menu icon, it's a trigger for some (currently unpublished) Turbolinks variant. The menu content is loaded (and subsequently 304'd) dynamically as a server-rendered partial (sans layout). Most tellingly, if you visit the menu content's XHR URL with regular browsing then hey.com renders that menu as the sole content in a page layout. We can't see the server-side parts yet, but if that becomes an out-of-the-box end-to-end behaviour within Rails, then in conjunction with Stimulus 2 and Action Cable I'm stoked about the possibilities. Especially so since I have a mission to replace all my dropdown & modal boilerplate with <details><summary> and <dialog> elements, and I like to build services that still work if JS is disabled. But it's also good for mundane stuff like progressive form validation in line-of-business apps.
- onnnon 6y agoHere's the Railties diff if anyone needs: http://railsdiff.org/6.0.3.4/6.1.0 http://railsdiff.org/6.0.3.4/6.1.0
- simonw 6y ago"rafaelfranca released this 1 hour ago · 324 commits to master since this release" That's the sign of a very actively maintained project! (To clarify: those 324 commits didn't all happen in the past 60 minutes, but it does show that there's a huge amount of development activity going on around Rails core)
- jamie_ca 6y agoYeah, I think this is indicative of a feature lock during the RC period, and once the release is cut that opened up a bunch of PRs that were just waiting in the wings.
- ksec 6y ago>Error Objects Active Model’s errors are now objects with an interface that allows your application to more easily handle and interact with errors thrown by models. The feature was implemented by lulalala and includes a query interface, enables more precise testing, and access to error details. This has been in the work since Rails 5.x and I believe Lulalala extracted it from his work on Gitlab. And it was lot of hard work. Since both Github and Shopify now runs on Master, I dont think there are any other open source web framework that is more battle tested than Rails. Still waiting for New Magic though.
- marinhero 6y agoI'm out of the loop. what is New Magic?
- maxfurman 6y agoDHH has been teasing something called "New Magic" on Twitter but beyond that we don't know much.
- ibraheemdev 6y agoDHH mentioned "NEW MAGIC" when he released the Hey stack on twitter [1]: > The HEY stack: - Vanilla Ruby on Rails on the backend, running on edge - Stimulus, Turbolinks, Trix + NEW MAGIC on the front end There has been a lot of speculation since then on what New Magic is. It was supposed to release at the same time as hey.com but they decided to postpone it till later. Many people think/hope that it is something similar to Phoenix LiveView 1: https://twitter.com/dhh/status/1275901955995385856 https://twitter.com/dhh/status/1275901955995385856
- nickjj 6y agoI asked DHH the other day about the server side aspects of NEW MAGIC and he replied with: https://twitter.com/nickjanetakis/status/1334940603457658883 https://twitter.com/nickjanetakis/status/1334940603457658883 So we know NEW MAGIC will involve a substantial amount of integration with Rails on the server side but it could technically be ported over to other frameworks. It's interesting because StimulusJS 2.0 and Turbolinks 6 are fully client side based on previous tweets by members of Basecamp. I wonder if NEW MAGIC will be focused on broadcasting real-time updates to the front-end while partial page updates that would normally be server rendered templates could be handled by Turbolinks 6 alone. That would be great news for anyone wanting to create amazing feeling apps with any back-end stack, without going the SPA route.
- kadabra9 6y agoI did a bunch of work in rails prior to the 3.0 days ( probably around 2013 or so), but then switched domains to work more in data engineering. When I came back to it to scratch an itch for some pet projects, I barely recognized it. I felt completely lost. Life moved pretty fast, I guess. Are there any good resources out there for someone from the 2.x days to get back to speed?
- 30minAdayHN 6y agoI fall in this same bucket. I still refer to the old railscasts now and then. I use rails for my hobby projects. Currently, I depend on Rails Guides, and I think they do a pretty good job. Would be good to know other resources. https://guides.rubyonrails.org/ https://guides.rubyonrails.org/
- mhoad 6y agoRailscasts sadly is no longer but now the two big ones that operate in that space are GoRails and Drifting Ruby. Some other non-screencast resources I like however are Boring Rails and Playbook Thirty Nine (ebook of tips and tricks from the trenches of a real life smalltime Rails SaaS business)
- kobaltz 6y agoI run https://www.driftingruby.com https://www.driftingruby.com which has a lot of updated resources.
- xionon 6y agoFor what it’s worth, the 2->3 update was by far the most consequential; they merged in Merb, rewrote how routes and controllers worked, and completely flipped expectations on how JS and views should work. Rails 3->6 has had far fewer major user-facing architectural changes, and consisted mostly of new tools and APIs. A lot of stuff they added used to be handled by gems - password hashing, attachments, background jobs, caching, etc. all got rolled into the core framework. Another comment mentioned https://guides.rubyonrails.org https://guides.rubyonrails.org, which is good. I would focus on the new routing style, REST controllers, forms, and strong params; once you wrap your head around those, the rest will probably fall into place, or could be ignored completely.
- tistoon 6y agoRails is getting even more mature of its existing maturity. That’s great!
- arthurcolle 6y agoHey, sorry for the aside - I am a Rails developer since Rails 4ish and we are running Rails 5 at work. I'm using Rails 6 for my own projects and in these side projects, I've been having a huge hell of a time trying to grok "right ways" to do things with webpacker/webpack. I seem to encounter issues every single time with deploys to Heroku because of precompilation issues, or imports not running right. But tutorials get out of date so fast and I'm constantly trying to just remove stuff just to get my builds to work. Are there any Rails focused chatrooms or places where I can get into the nitty gritty of these things without needing to post GitHub issues and piss off maintainers all the time? I just don't really grok how to use modern Javascript I guess, but also integrating with Rails webpacker has been a source of constant frustration. I can't even figure out how to properly package JS libs without just giving up and using jsdelivr instead. Would love any kind of pointers!
- baggy_trough 6y agoPersonally, I stay away from that entire bag of brain damage and do the asset pipeline with Sass and plain ES5 Javascript.
- arthurcolle 6y agoWanna be friends and show me the way? Webpack seems super popular, but like there's so much shit going on. Ok node, great.. JS runtime, got it. NPM, package manager, alls good so far, just like Hex for Elixir or Cargo for Rust, perfect, makes sense. Oh wait, huh? I gotta use yarn for my webpack? Alright... yarn add <module>, then I gotta precompile my assets... why? Why can't I just have that happen at build/deploy time? ... ok.... Then I get errors like this (even though I can run my app locally and everythings fine): <markup> Parsed request is a module using description file: [absolute path to my repo]/package.json (relative path: ./src) Field 'browser' doesn't contain a valid alias configuration aliased with mapping 'components': '[absolute path to my repo]/src/components' to '[absolute path to my repo]/src/components/DoISuportIt' using description file: [absolute path to my repo]/package.json (relative path: ./src) Field 'browser' doesn't contain a valid alias configuration after using description file: [absolute path to my repo]/package.json (relative path: ./src) using description file: [absolute path to my repo]/package.json (relative path: ./src/components/DoISuportIt) as directory [absolute path to my repo]/src/components/DoISuportIt doesn't exist no extension Field 'browser' doesn't contain a valid alias configuration [absolute path to my repo]/src/components/DoISuportIt doesn't exist .js Field 'browser' doesn't contain a valid alias configuration [absolute path to my repo]/src/components/DoISuportIt.js doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration </markup> and I don't even know what to say. What the hell is going on? Why has God forsaken me?
- pupdogg 6y agoIt would be really nice if they gutted out webpack for something like snowpack! Asset compile times kill the overall deployment experience.
- dlrush 6y agoLooking to try this out shortly. Hopeful: https://github.com/ParamagicDev/snowpacker https://github.com/ParamagicDev/snowpacker
- Existenceblinks 6y agoOne of my favorite characteristic of Rails community is there is less to non-existence of superiority of paradigm nonsense. Since I switched to other languages/frameworks, discussion around Slack/forum is plenty of non-realworld usage .. great engineering (without user interaction). It's painful when you want to ship, not only to play. Rails is full of libs for building real business. Github and Shopify 's engineers are around, this contributes great sense of realword usage. Features extracted from that are battle-tested. Bonus is DHH is still involving since he loves programming anyway, and he is a great communicator, spicy tweets on HTML CSS keeps the web sane .. from those madness.
- joelbluminator 6y agoWhat did u switch to? I keep wondering whether I should stick to Ruby and call it a career or just look for jobs that interest me / good career move , regardless of stack.
- nickjj 6y agoYeah this is exactly how I feel too. Rails really is something special that can't be replicated by simply leaving the Ruby ecosystem and trying to reinvent "the good parts" in another language / framework. You'll be missing out on one of the best parts of Rails which is an actual business extracts features into Rails from real world usage. That and Shopify + GitHub + Basecamp are running Rails master so by the time regular folks like us use a release it's already insanely tested in the real world with hundreds of millions of requests passing through these features. The confidence level that brings to the table that it's going to work for your app is unrivaled. The massive amount of community support (gorails, etc.) and library ecosystem is icing on the cake.
- asdf333 6y agoI'm hoping for vuejs and rails tie together. As a previous rails developer I never loved backbone angular or react but felt at home with vuejs and am jealously watching the laravel community embrace vue