
Rails 6.0 - vipulam
https://weblog.rubyonrails.org/2019/8/15/Rails-6-0-final-release/
======
mhartl
Congrats 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
Thank 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
Great, glad to hear it!

------
masonhensley
Cool! 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
on 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
If 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-controlle...](https://www.engineyard.com/blog/keeping-your-rails-
controllers-dry-with-services)

------
felipeccastro
I'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.

~~~
PopeDotNinja
There's nothing wrong with some good ol server side template rendering. Non
trivial pages will take longer to render though.

~~~
simplecomplex
How 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.

~~~
pmontra
If you're creating a desktop application in the browser, a SPA is the way to
go or the experience will be nightmarish for both users and developers. For
anything else a classical server rendered web app is OK. Example: Amazon is
not a SPA.

------
thrownaway954
Congrats 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
I’m considering learning rails for a new project. Also coming from a .NET
background. Any good resources you can recommend?

~~~
thrownaway954
YouTube 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
OMG! Railscasts got me through so much in the early days. I didn't realize
that they were on YouTube. Nice!

------
kemenaran
Rails 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!

------
conorh
Started 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_da...](https://edgeguides.rubyonrails.org/active_record_multiple_databases.html)

------
hirundo
Apparently reports of Rails' death are greatly exaggerated.

~~~
nullwasamistake
Eh, 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.

~~~
bdcravens
What are you using for the backend? A SPA has no value without one. Unless
you're using something like Firebase, pretty good chance your backend is an
MVC app. (I think you're confusing server-rendered apps with the MVC pattern)

~~~
nullwasamistake
Eh I guess I meant "traditional" web MVC where HTML template for the whole
page is pre-rendered on the server.

We use gRPC web, so backend is a bunch of RPC endpoints. Front end is regular
SPA.

This has worked great for us because it reduces backend to "shipping objects"
instead of all the bs you normally have to deal with in HTTP.

With gRPC there's no use for rails, or any HTTP server framework. As far as I
can tell, this is the future of web endpoints, so rails will die out.

~~~
bdcravens
> rails will die out

That'll suck. Hope your company doesn't use Github.

~~~
nullwasamistake
Amazon still runs a bunch of Perl in the back. Just because you're stuck with
some design choice doesn't mean that framework has a solid future. People
still write plenty of COBOL but you don't see any new applications using it

~~~
rubyfan
Plenty of new mainframe code is written in corporate settings. Legacy
modernization is strong as ever and for some companies that doesn’t mean
moving off mainframe - it means upgrading, cleaning up and cloning legacy
COBOL code bases and some times writing new.

------
nickjj
I 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
Probably WordPress.

~~~
bhaak
Maybe I'm nitpicking but WordPress is a CMS and not a generic web framework.

------
maz1b
Very 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
Is this passmed, by any chance?

------
jacobkg
The multiple database support is really exciting. Anything that makes it
easier to push database reads to replicas is huge!

~~~
gotts
The 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
How 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
It is read-your-writes semantics, and the metadata is stored in the session.

------
peteforde
For 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/834e82f5723fec9d2dc021fb7b81...](https://gist.github.com/andyyou/834e82f5723fec9d2dc021fb7b819517)

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!)

------
jmkim
Finally!! 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)

------
aantix
Rails 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.

------
hartator
Love the parallel testing thing. I wonder if it’s already working with Rspec.

~~~
jihadjihad
They 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.

------
mintplant
Would 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
Sure, 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
Oh, so it's similar to PHP's autoloading based on psr4.

------
ulugh
Congrats 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 !

------
reneherse
Great 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
Use 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
Awesome, thanks for the tip.

------
ksec
Congrats. 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)

------
meow_mix
Thrilled 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.

------
survili
Framework 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.

------
chachra
Support for multiple databases? Django added that 9 years back!? -
[https://django.readthedocs.io/en/1.4.X/releases/1.2.html#sup...](https://django.readthedocs.io/en/1.4.X/releases/1.2.html#support-
for-multiple-databases)

Are they both talking about the same thing, or I am missing something?

~~~
peteforde
It's a lot more than talking to pg and mysql at the same time, thankfully!

[https://edgeguides.rubyonrails.org/active_record_multiple_da...](https://edgeguides.rubyonrails.org/active_record_multiple_databases.html)

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.

------
jhund
Thanks to the Rails team for a great release! I'm enjoying the stimulus js
framework to handle client side UI behavior.

------
Madeindjs
Glad 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)

------
heeebeeejeebees
Finally 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
Funny, I first saw this law mentioned yesterday in a discussion about a new
PHP Laravel package for handling incoming mail.

~~~
kirubakaran
Once you hear about Baader-Meinhof effect, you see Baader-Meinhof effect
everywhere.

------
phodo
What 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
I 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.

------
sneakernets
Nothing beats Rails for slinging out a website or interactive "web app" in a
week.

------
buf
It's christmas eve already?

~~~
gls2ro
I think you are confusing Ruby (the language) with Ruby on Rails (the
framework).

Ruby - the language - is the one released usually on Christmas.

------
whalabi
I 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
Wow, Multiple DB and Parallel Testing is super productive.

I hope framework maintainers of other language community should also get
inspired by these features.

------
jasonm89
Exciting! I've been a rails developer for the past 5 years, hoping to hold
onto it for as long as possible!

------
fastbmk
Nice! [https://is.gd/HhcnHi](https://is.gd/HhcnHi)

------
bigwheeler
I’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!

------
jsvcycling
I haven't used Rails since 5.0 came out. Might be time to take a look at it
again.

------
pythonist
Very cool! Congratulations!

I was happy to se new Rails notification from newreleases.io today.

------
fastbmk
How does it compare to Elixir/Phoenix?

------
Madeindjs
Congrat, so excited to test it.

------
tistoon
Congrats!

------
bbmario
What 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
Do 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
As 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
Shopify 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
"Bigger than a shopify website" is a possible interpretation.

------
snitko
Ah, great, all the features we don't need, but would have to upgrade to
anyway.

