13 ms·
Rails 6.0
- heeebeeejeebees 7y agoFinally made it! Congratulations! Zawinski's Law “Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.” --- Action Mailbox routes incoming emails to controller-like mailboxes for processing in Rails. It ships with ingresses for Amazon SES, Mailgun, Mandrill, Postmark, and SendGrid. You can also handle inbound mails directly via the built-in Exim, Postfix, and Qmail ingresses. The foundational work on Action Mailbox was done by George Claghorn and yours truly.
- jjeaff 7y agoFunny, I first saw this law mentioned yesterday in a discussion about a new PHP Laravel package for handling incoming mail.
- stunt 7y agoRails and Laravel have many things in common. In some cases one is ahead of the other one.
- kirubakaran 7y agoOnce you hear about Baader-Meinhof effect, you see Baader-Meinhof effect everywhere.
- rxhernandez 7y agoI sincerely mean no harm by this but: Web developers are to the rest of developers what internet people in the us are to the rest of the world. That is, I think y'all forget that there are many other types of development that look nothing like web development. I think I might come very close to losing my mind if I worked somewhere where someone arbitrarily sticks code to read mail in the firmware I was working on.
- lovetocode 7y agoIt sounds like you are implying that web developers are beneath you. Building web based software is more complex than slapping together some HTML, JavaScript and CSS.
- rxhernandez 7y agoI am absolutely not saying that. What part of any of that says they are beneath me? When a European tells an American that they're not the only ones on the internet you people don't jump down their throats. When I do it you people lose your collective shit.
- chipotle_coyote 7y agoWhen a European preemptively tells an American that they're not the only ones on the Internet based on stereotypes about Americans, then yeah, that's kind of offensive. You've insulted Americans based on stereotypes, insulted web developers based on stereotypes, and when people point it out to you, you keep doubling down on it. Let this Ugly American suggest to you that perhaps you should consider following the First Rules of Holes: when you're in one, stop digging.
- davidw 7y agoIt's sort of a metaphor for bloat: https://en.wikipedia.org/wiki/Jamie_Zawinski https://en.wikipedia.org/wiki/Jamie_Zawinski
- rxhernandez 7y agoEven then, that level of bloat is unique to certain types of development. In more regulated industries, like medical devices, more code can translate to high regulatory costs.
- mhink 7y agoOh, get over yourself. That quote doesn't have anything to do with web development (and for that matter, it hardly has anything to do with mailboxes, except as a tongue-in-cheek example of an extraneous feature) so I have no idea why you feel the need to take a swing at another discipline that you clearly don't know the first thing about.
- craz8 7y agoHah! And with not a lot of code and an ActionText integration, you can write some nice looking emails too! I can build my own Gmail in an hour!
- masonhensley 7y agoCool! After a hiatus from Rails, I threw together an internal tool this week with 6.0.0.rc2 - breath of fresh air in a world of microservices and complex architectures. Good job rails team! === Edit: P.S. - Thanks rails community too! Was super simple to build thanks to the vibrant community... - Corporate SSO via devise + omniauth - CSV uploads (activerecord-import gem) - pagination (will_paginate gem) - external API integration - DB seeding - audit logging on edited/created data (audited gem) - wizards (wicked gem) - etc, etc.
- greenie_beans 7y agoon a whim...do you know of any good guides for integrating an external API? i'm new to rails and working on a rails project that needs to communicate with a third party api -- there are a lot of messy guides, particularly for oauth
- masonhensley 7y agoIf I was starting out fresh, I'd probably try and check out some of the guides that services like stripe and github have for interacting with their own api's if you'd like some real world experience. Here some links: - https://github.com/octokit/octokit.rb https://github.com/octokit/octokit.rb - https://github.com/stripe/stripe-ruby https://github.com/stripe/stripe-ruby Depending on how you set up your app, you should look into organizing your external services like this: https://www.engineyard.com/blog/keeping-your-rails-controllers-dry-with-services https://www.engineyard.com/blog/keeping-your-rails-controlle...
- tra3 7y agoI don't know of a library for external API integration (so I'll be watching this space), but for OAuth specifically, Omniauth has been invaluable. It supports a lot of various strategies [0] which is what it called various OAuth2 implementations. 0: https://github.com/omniauth/omniauth/wiki/List-of-Strategies https://github.com/omniauth/omniauth/wiki/List-of-Strategies
- mr-ron 7y agoI think the pattern of making generic classes that leverage the httparty gem is solid. Depending on your preference have another layer of classes between that and your models. Or have the apis called directly from models or controllers
- hartator 7y agoLove the parallel testing thing. I wonder if it’s already working with Rspec.
- jihadjihad 7y agoThey mentioned in the PR that it seems like an adapter for rspec/cucumber needs to be added for that to work out--I, too, am hoping that such a thing comes to fruition.
- tistoon 7y agoCongrats!
- jsvcycling 7y agoI haven't used Rails since 5.0 came out. Might be time to take a look at it again.
- hirundo 7y agoApparently reports of Rails' death are greatly exaggerated.
- beefhash 7y agoRails just became boring technology. It works. The hype is gone, but it continues chugging along happily and is generally an understood problem.
- thrownaway954 7y agoI think you mean mature.
- nullwasamistake 7y agoEh, no. The whole MVC pattern is obsolete and every web project I've worked on less than 5 years old is a SPA. It's gone the way of PHP. It will always be around in legacy stuff but hardly anyone is building new project with it.
- paublyrne 7y agoYou can very easily eschew the V and run your spa against a Rails API.
- 7y ago
- jacobkg 7y agoThe multiple database support is really exciting. Anything that makes it easier to push database reads to replicas is huge!
- gotts 7y agoThe cool thing about multi-database feature that's coming to Rails is setting like >config.active_record.database_selector = 2.seconds Rails provides a way to make sure that at-least for first two seconds after the write operation, read requests are handled by the write instance. This assumes that your read replica will get updated within 2 seconds with the live data. How cool is that
- takeda 7y agoHow does that work though? If you have multiple instances that are serving the same traffic, how do one know about the change made by the other? Is it a global timer? i.e. any write affects reads, or it knows and only works on the same table? Why not keep dependent operations within the same transaction? If that would be done by rails from the start then I could just easily split read/write through pgpool.
- fxn 7y agoIt is read-your-writes semantics, and the metadata is stored in the session.
- hirundo 7y agoWe've been doing this for years on a Rails 3 app. We yield from a `slave` method, with the connection pointing to the replica DB until yield returns. It's just a short method. It's great if Rails now supports this directly, but a shame if people have been waiting for it.
- scruple 7y agoDitto, though we started this behavior in Rails 3 or 4, I no longer recall, and are now on 5.2.X.
- thrownaway954 7y agoCongrats on shipping!!! Been doing Rails for the past year coming from a C# and ColdFusion background. God I love what you can accomplish in a short amount of time with Rails. ColdFusion became a nightmare since there is NOTHING for it any more. C#, though awesome, is just too verbose. Rails and Ruby are a God send.
- imafish 7y agoI’m considering learning rails for a new project. Also coming from a .NET background. Any good resources you can recommend?
- jeremy_k 7y agoThis is the defacto learning guide https://www.railstutorial.org/ https://www.railstutorial.org/, although not currently updated for Rails 6. Oh I totally missed his reply in this thread https://news.ycombinator.com/item?id=20718729 https://news.ycombinator.com/item?id=20718729 (currently at the top)
- bdcravens 7y agoI also recommend the Rails Tutorial; it covers a lot in a short amount of time.
- thrownaway954 7y agoYouTube is your friend: GoRails (https://www.youtube.com/channel/UCIQmhQxCvLHRr3Beku77tww https://www.youtube.com/channel/UCIQmhQxCvLHRr3Beku77tww) Drifting Ruby (https://www.youtube.com/channel/UCxJaNyXCQw0mghY0hA1wA9w https://www.youtube.com/channel/UCxJaNyXCQw0mghY0hA1wA9w) Railscasts Reloaded (https://www.youtube.com/user/RailscastsReloaded https://www.youtube.com/user/RailscastsReloaded)
- Corrado 7y agoOMG! Railscasts got me through so much in the early days. I didn't realize that they were on YouTube. Nice!
- conorh 7y agoStarted a new project with Rails 6.0.0.rc2 the other day. Great experience, up and running quickly and enjoyed all the new little touches (object allocations in the logs is great). The multi database[1] thing is also great to have built in - the new app has an analytics database and a web app database that it needs to query, so it is great to be able to use the new functionality for that! [1] https://edgeguides.rubyonrails.org/active_record_multiple_databases.html https://edgeguides.rubyonrails.org/active_record_multiple_da...
- survili 7y agoFramework that works. If you are building a business - use it. If you are into developers masturbation - use something that was released a month ago and got lots of GitHub stars/HN upvotes.
- mhartl 7y agoCongrats to the Rails team! With this new major release, I’m planning to update the Ruby on Rails Tutorial accordingly. See here for details: https://news.learnenough.com/ruby-on-rails-6 https://news.learnenough.com/ruby-on-rails-6 You can join the Learn Enough/Rails Tutorial email list to receive a notification when it’s ready: https://news.learnenough.com/email-list/ https://news.learnenough.com/email-list/
- HalcyonicStorm 7y agoThank you so much for your work! I owe a lot of my initial success in getting into the industry and setting up my career to your book!
- mhartl 7y agoGreat, glad to hear it!
- mud_dauber 7y agoReally, really happy to hear this. The Hartl tutorial is my gold standard. Props.
- jmuguy 7y agoThank you Michael! I will forever be grateful for your work on Rails Tutorial, it started me on my path to becoming a developer and the Learn Enough series has been super awesome.
- PopeDotNinja 7y agoThat is indeed a fabulous tutorial.
- briandear 7y agoI work as a senior engineer at a FAANG and this whole road started with The Rails Tutorial. It isn’t hyperbole to say that Mike Hartl changes lives. Him and the old RailsCasts dude deserve to be in the Rails Hall of Fame.
- metanoia 7y ago
- mintplant 7y agoWould someone more familiar with Ruby mind explaining what Zeitwerk is/does? I think I have a vague idea, but both the announcement post linked to from this one and the project's README assume a lot of prior knowledge about the use case.
- cookrn 7y agoSure, I can try! One part of the Rails "magic" that the framework tries to abstract away from an app developer is code loading. So, instead of each file in your app needing to explicitly specify using "require" statements which other files it needs to run, Rails uses Ruby to automatically "require" files for you. This system is dependent on constant names and namespaces matching file names and directory structures. So, a constant (Rails model) like "Sports::Player" used in a controller might be found via lookup automatically in "app/models/sports/player.rb". A system which does this has been a part of Rails for a _very_ long time, and Zietwerk is an upgrade to it by a longtime Rails contributor that fixes some of the previous downsides and gotchas.
- bogdanu 7y agoOh, so it's similar to PHP's autoloading based on psr4.
- Dangeranger 7y agoSure, I'll give it a shot. Ruby classes usually need to explicitly require the other classes and modules which they use. Rails implemented a different way to achieve requiring dependencies using a method called "const_missing" which requires the missing dependent when it is not found in the known constant list. The problem with this is that if your classes and modules do not adhere to a strict arrangement within your source code directories then Rails can sometimes not find the file you are looking for, or worse find the wrong file. Since "require" has an effect on the loaded constant namespace, the order of requiring dependencies can make a difference in the presence of bugs related to which code has been required. There's more information here: https://github.com/fxn/zeitwerk#motivation https://github.com/fxn/zeitwerk#motivation
- maz1b 7y agoVery exciting. While in medical school, I taught myself a decent amount of Ruby and learned the Rails framework due to an old mentor of mine. The same app that I learned with is now a full fledged startup, with thousands of future doctors using it, and one of our DB tables has nearly 1m objects. Kudos to the rails team, really. I know a lot of titles and headlines talk about "is Rails dead?" and this should put it to rest. It might not be the most cutting edge technology, but it's proven.
- bigzyg33k 7y agoIs this passmed, by any chance?
- snitko 7y agoAh, great, all the features we don't need, but would have to upgrade to anyway.
- jmkim 7y agoFinally!! Let's have a party! \o/ A lot of web apps in Debian are depending on Ruby on Rails 5. Right now, I'm making their transition for 6.0.0 with its RC1 [1]. So glad to meet its stable release now. [1] https://wiki.debian.org/Teams/Ruby/Rails6 https://wiki.debian.org/Teams/Ruby/Rails6
- buf 7y agoIt's christmas eve already?
- deleted 7y ago[deleted]
- gls2ro 7y agoI think you are confusing Ruby (the language) with Ruby on Rails (the framework). Ruby - the language - is the one released usually on Christmas.
- pythonist 7y agoVery cool! Congratulations! I was happy to se new Rails notification from newreleases.io today.
- reneherse 7y agoGreat news, and a hearty congrats and thank you to all the contributors! As a frontend designer, I'd been hoping for some mention of faster SASS/SCSS compiling, but it looks like it's the same asset pipeline for that. Can anyone recommend a current resource for decreasing compile times? I love designing in a Rails app, but my non-Rails projects all seem to inject CSS changes into the browser almost instantaneously, whereas with Rails there's often a wait of up to 10 seconds. The lag is pretty disruptive to the design workflow. I'm pretty new to Rails so any tips on what I might be doing wrong would be appreciated :)
- sansnomme 7y agoUse Webpack for SCSS (and if necessary enable PostCSS, though I am pretty sure Rails' Webpack config supports SCSS by default) and enable livereload, the problem will fix itself.
- reneherse 7y agoAwesome, thanks for the tip.
- tomphoolery 7y agosassc-rails is helpful since it binds to libsass.
- peteforde 7y agoDefinitely switch over to sassc-rails, which should give you a massive speed boost. I also run an instance of bin/webpack-dev-server which handles all of my dev-time Sass pushing needs. One thing I'm a little sad about is the decision to continue using sprockets (aka Asset Pipeline) for CSS and images. My understanding is that a lot of gems would break if they changed but I can't help feel an opportunity was lost to bite the bullet and do the big switch all at once. I guarantee you that it's coming. Luckily, I can say that switching to using Webpack for CSS is very doable. The best instructions are here: https://gist.github.com/andyyou/834e82f5723fec9d2dc021fb7b819517 https://gist.github.com/andyyou/834e82f5723fec9d2dc021fb7b81...
- Madeindjs 7y agoCongrat, so excited to test it.
- Madeindjs 7y agoGlad to hear this. This sound so good. I started to update my book about building an API with Rails 6 [1]. I hope to finish it this week-end. Thank to all Rails community to build this exciting project [1]: https://github.com/madeindjs/api_on_rails https://github.com/madeindjs/api_on_rails
- sneakernets 7y agoNothing beats Rails for slinging out a website or interactive "web app" in a week.
- bbmario 7y agoWhat is the fastest web server for Rails today? I've always wanted to run something serious with Rails, but the performance always puts me off.
- prab97 7y agoDo you plan to run something more serious than github, basecamp or shopify? Usually it is not rails, which is the bottleneck, but the architecture of your application.
- bbmario 7y agoAs a matter of fact, yes. Not as big as GitHub, but bigger than Shopify. So the choice of application server matters, as well as how easy it is to scale and provision that server.
- freehunter 7y agoShopify has 800,000 customers, 4,000+ employees, and handles over $40,000,000,000 per year. And you're building something from scratch, starting today, that is going to be bigger than Shopify in a fast enough timeframe that your Rails server today is the biggest concern?
- SquareWheel 7y ago"Bigger than a shopify website" is a possible interpretation.
- quickthrower2 7y agoSomething doesn’t add up: You have have a high profile project that is bigger than Shopify (!) but you ask a question that seems like the first question you should type into google to research this if you were interested.
- dwheeler 7y agoI don't know if it's the fastest, but I've had good success using Puma with Ruby on Rails in a real-world production site. That said, if performance is your goal, then the web server is only a small part of it. In my experience, the way to get a high-performing Ruby on Rails application is primarily through fragment caching and using a CDN. You can get excellent performance with very little effort that way.
- jasonm89 7y agoExciting! I've been a rails developer for the past 5 years, hoping to hold onto it for as long as possible!
- kemenaran 7y agoRails has been the joy of my web developer life for the past five years. Went through native development, SPAs, etc. – and happily came back to Rails in the end. The productivity of it is just fantastic. Congrats for shipping, and to many good years to come!
- aantix 7y agoRails 6 coupled with a starter template like Jumpstart Pro, and you can literally have a complete MVP SAAS app up running (payment support, team support), within a few hours. Rails continues to win in the productivity category.
- bigwheeler 7y agoI’ve been using Rails since 1.2, and somehow it has never lost it’s magicalness for me. These days I might eventually end up using something different to build a production app, but Rails is always still the first tool I reach for. It is absolutely incredible to me how much value DHH and the core team have created with it. I’ve got a new project starting Monday, so this is great timing! Thanks to all the Rails contributors that made this happen!
- ulugh 7y agoCongrats to the Rails team ! I can't praise Rails enough. Such a huge boost in productivity for prototyping or full production app. I use it for both work or side project. I can't imagine a world without it. Long live Rails !
- chachra 7y agoSupport for multiple databases? Django added that 9 years back!? - https://django.readthedocs.io/en/1.4.X/releases/1.2.html#support-for-multiple-databases https://django.readthedocs.io/en/1.4.X/releases/1.2.html#sup... Are they both talking about the same thing, or I am missing something?
- peteforde 7y agoIt's a lot more than talking to pg and mysql at the same time, thankfully! https://edgeguides.rubyonrails.org/active_record_multiple_databases.html https://edgeguides.rubyonrails.org/active_record_multiple_da... In short, to do this feature family properly and in an opinionated, predictable way means that you have to cover a number of non-trivial cases. Multiple primaries and their replicas is just the beginning: - automatic connection switching on a per-model basis - Automatic swapping between the primary and replica depending on the HTTP verb and recent writes - Rails tasks for creating, dropping, migrating, and interacting with the multiple databases Sharding, cross-cluster joins and load balancing replicas are coming soon. I think what's important here is that every site over a certain scale previously needed to implement their own take on this, and there were a lot of thorny edge cases, race conditions and heisenbugs to do so. It's kind of like the old chestnut that if you find yourself writing original crypto code, you're probably doing it very wrong. The fact that any project can uncomment a few lines and get all of this for free is properly awesome.
- felipeccastro 7y agoI've been working with Rails for several years. First, it was fullstack rails, then we got a giant mess of jquery, tried to solve it by moving to an SPA with Vue... and since then our productivity really dropped. While Vue works, I miss the productivity of having a single server app to maintain, instead of two. I'm considering moving back to Rails only, with the aid of some library like Unpoly for the nice ajax unobtrusive javascript helpers. Congrats on the release, and thanks for helping to keep alive the model of server-rendered apps, while everyone else appears to be moving to SPAs.
- acangiano 7y agoYou might find Rails + Turbolinks + Stimulus to be relatively headache-free.
- PopeDotNinja 7y agoThere's nothing wrong with some good ol server side template rendering. Non trivial pages will take longer to render though.
- simplecomplex 7y agoHow is that possible if you're comparing the same data loaded on the client vs the server? Server has a faster Internet connection and connects to the DB directly (not over HTTP). Sure, clients load "faster" if you mean they don't actually load everything. Apples to oranges. If a page needs to make 5 DB queries to present a bunch of data, those 5 DB queries will be faster on the server than from the browser. So will parsing the response and transforming it into HTML.
- theptip 7y agoYou can do the first render without loading everything from the DB, then load your more expensive data while the page is loading. Or do infinite scrolling and only load 10 rows from the DB, where you would have to render more rows to be usable if you didn't have infinite scrolling.
- 7y ago
- nickjj 7y agoI think one of Rails' biggest strengths is: > In fact, GitHub, Shopify, and Basecamp, as well as plenty of other companies and applications, have been running the pre-release version of Rails 6 for months and months in production. Test suites are nice and all but nothing beats having tons of real world production workloads thrown at something to really test it and iron out a good developer API. There's just a massive amount of confidence you have that you won't be the one having to pioneer some weird edge case bug. Can someone list at least 1 other popular web framework that has multiple individual sites pushing billions of page views through it before it hits a stable release?
- faitswulff 7y agoProbably WordPress.
- krob 7y agoSymfony. Last i heard, pornhub ir youporn was using it and their traffic dwarfs most other sites.
- ludwigvan 7y agoNot multiple sites perhaps, but Facebook uses React's unstable versions on production.
- ksec 7y agoI would not be surprise if there was a PHP framework that rivals that in page view. But I don't think there will be any other framework that gives as much confidence to developers as Github and Shopify. I think Cookpad wants to test Rails Pre-Release in the future as well, that is a site possibly bigger than Github. I wonder if Apple Music is still on Rails.
- jhund 7y agoThanks to the Rails team for a great release! I'm enjoying the stimulus js framework to handle client side UI behavior.
- phodo 7y agoWhat is the lightest weight, best practice / pattern for using rails, not django/flask, to call python-based programs (e.g. python machine learning inference such as tensorflow/pytorch, or other scientific computing like scikit or numpy) on a lean server (keeping costs down)?
- ewalk153 7y agoI would probably write a flask wrapper and expose an api to the Rails app. I’ve seen this done successfully at scale in a large Rails app.
- cutler 7y agoI think Node.js is the better choice for this than Rails. You want your Python number-crunching API accessed async leaving Node to take care of auth, logging and database reads. With your Python API returning JSON I would imagine Rails serialisation would slow down performance relative to Node.
- meow_mix 7y agoThrilled about this. Haven't written rails in a few years because I've mostly been backend at a FAANG co, but if I had to build a small-medium size site again I'd go back in a heartbeat.
- peteforde 7y agoFor people who are making the switch from Rails 5 to 6, or transitioning from Sprockets to Webpacker, I strongly urge you to bookmark what I consider to be the missing manual for everything that falls through the cracks: https://gist.github.com/andyyou/834e82f5723fec9d2dc021fb7b819517 https://gist.github.com/andyyou/834e82f5723fec9d2dc021fb7b81... My only complaint with v6 is that we didn't take the opportunity to make a clean break from the Asset Pipeline. I know that there are gems that would break etc. Luckily, the process moving CSS to Webpacker is made easy via this document. Tips! If you're using Sass, make sure you switch from sass-rails to sassc-rails. Stimulus is an awesome solution for your JS needs. Don't even think about React again until you've at least considered the power of a well-cached backend fronted by a Stimulus + Turbolinks solution. Try to get an early handle on the multiple ways that import can be used in your JS files. There are three different forms and they all have subtleties that can bite you: import 'library' import { x, y, z } from 'library' import * as Library from 'library' If your JS has require() directives, convert them to import directives. import is the future. Finally, don't ever let anyone shame you out of using jQuery. jQuery rocks and is an incredibly powerful tool that still brings superpowers to the table. Anyone who suggests it's simply "bad" is not bringing good arguments to the table. (But when things get hairy, take a good look at Stimulus!)
- whalabi 7y agoI love rails, but I found the wild that the metaprogramming can make things far more complex and unintuitive than they need to be. Has anyone else thought the same? Any tools to work around this?
- truth_seeker 7y agoWow, Multiple DB and Parallel Testing is super productive. I hope framework maintainers of other language community should also get inspired by these features.
- fastbmk 7y agoHow does it compare to Elixir/Phoenix?
- deleted 7y ago[deleted]
- fastbmk 7y agoNice! https://is.gd/HhcnHi https://is.gd/HhcnHi
- ksec 7y agoCongrats. Unfortunately my favourite PR [1] Model error as object didn't make it into Rails 6, but it will be in Rails 6.1 Active Storage still needs work [2], ( I really wish paperclip had stayed a little longer ), but the update should really be good enough for general purpose usage. And hopefully someday Action Cable would really work without switching over to Any Cable, the latency are way too high. And I heard Stimulus 2.0 [3] is coming too. And with Github and Shopify taking more hands on approach in development, Rail's future is brighter than ever. [1] https://github.com/rails/rails/pull/32313 https://github.com/rails/rails/pull/32313 [2] https://github.com/rails/rails/issues/31419 https://github.com/rails/rails/issues/31419 [3] https://github.com/stimulusjs/stimulus/pull/202 https://github.com/stimulusjs/stimulus/pull/202