Introducing Action Text for Rails 6

Action Text is a brand new framework coming to Rails 6 that’s going to make creating, editing, and displaying rich text content in your applications super easy. It’s an integration between the Trix editor, Active Storage-backed file and image processing, and a text-processing flow that ties it all together. With Action Text, you really shouldn’t ever have to impoverish your users with a vanilla textarea ever again!

Rails 6 is still a long ways off – we’re hoping to start the beta process in early 2019 – but Action Text is already in pretty decent shape. Yes, this is an alpha preview, and we haven’t even merged it into rails/rails yet, but it’s a release that’s been extracted from the code we’ve been using to power rich text editing in Basecamp 3 for several years now.

The Trix editor itself just turned 1.0, and is the product of endless craftwork by Sam Stephenson and Javan Makhmali. Both of whom also worked on Action Text to extract our Basecamp wrapping into this reusable package.

As part of this introduction, I’ve recorded a brief video showing how Action Text works with a sample application. Do check it out, and if you’re interested, now is a great time to get involved helping to shape a major new framework in Rails.

Rails 6 really is shaping up to be a major release. Besides Action Text, we’ve been cooking several other new frameworks in Basecamp 3 that we hope to extract. On top of all the wonderful work coming from others in the community, like the multi-db and parallel testing extractions that the team at GitHub are responsible for. This is a great time to be in Rails!

Multi env credentials support, Action Cable channel unit testing and more!

Hello everyone! This is Prathamesh from Pune, India bringing you the latest news from the Rails world.

Multi environment support for credentials

Now it is possible to have credentials for each environment. If the file for current environment exists it will take precedence over config/credentials.yml.enc. For eg. production environment looks for
config/credentials/production.yml.enc first.

Support for unit testing Action Cable channels

This change introduced ActionCable::Channel::TestCase  which provides an ability to unit test channel classes.

Raise error when using recyclable cache keys using a store which does not support it

Some cache stores do not support recyclable cache keys. This can lead to generating the cache entries which never invalidate.

This change adds a check to ensure that if recyclable cache keys are being used then the cache store needs to show that it supports this versioning scheme. 

Improvements to migration paths of multiple databases

This change adds an option to specify the migrations paths while generating the models.

bin/rails g model Room capacity:integer –migrations-paths=db/kingston_migrate

Additionally, a shortcut database option is added which uses the database configuration for the current environment.

Eagerly define attribute methods in production

The attribute methods for a model are currently defined lazily the first time that model is instantiated, even when config.eager_load is true.

Now they are defined while the app is booted to save the database round trip costs. There is related discussion and a pull request to do this change only when schema cache exists.

Ignore psqlrc files when executing psql commands within Rails

.psqlrc files can affect the execution of commands that can hold up execution by blocking or cause side effects.

Rails ignores it now by using -X option.

It is also ignored while loading structure.sql file for PostgreSQL databases by Rails.

Add a way to check for subset of arguments when performing jobs

The arguments need to match exactly what the job get passed when calling assert_performed_with / assert_enqueued_with

This change makes it possible to only check if a subset of arguments were passed to the job. Handy when you have too many arguments for the job.

50 people contributed to Rails over the past two weeks. Check out the full list of changes. If you are interested in helping out, we have plenty of open issues. I hope to see your name on the list next week!

Performance improvements, configuration options, and more

Greetings! Daniel here, reporting from Brooklyn, NY.

Use faster globs for template resolving

Resolving templates used to get pretty slow as the number of view paths, handlers, and formats increased. Replacing 1682 system calls with 14 sounds pretty great to me!

Do less work and use less memory

2.4% faster, 1.7% faster, 1.58% faster. Many thanks to Richard for working hard so our applications don’t need to!

Improve performance of Integer#multiple_of?

With a few clever tweaks, it has never been easier to find out if 4611686018427387903 is a multiple of 42.

Default to utf8mb4 for MySQL

The previous default character set did not support supplemental characters like emoji. The 4-Byte utf8mb4 has you covered. 👍 

Introduce model-level configuration for filtering sensitive attributes

Nobody wants sensitive data to show up in logs. The new filter_attributes setting allows you to filter out sensitive attributes when calling a model’s inspect method.

Introduce configurable prefix for Active Storage routes

By default the Active Storage routes begin with
/rails/active_storage. If that doesn’t suit you, you can now use any scope you like by setting config.active_storage.routes_prefix in your application config.

Include an id in Action Cable’s Redis configuration

Action Cable now passes an id to Redis, which can help you distinguish between Action Cable’s connection and any other connections you might have.

44 people contributed to Rails over the past two weeks. Check out the full list of changes. If you are interested in helping out, we have plenty of open issues. I hope to see your name on the list next week!

Read replica database configurations, faster parameter filtering, and more!

Hello everyone! This is Eugene, bringing you the highlights from the last week of activity in the Rails codebase.

Add hooks to Active Job on retries and discards

Your application can now subscribe to be notified whenever a job is retried or discarded. Neat!

Support read replica database configurations

Database configurations can now be flagged as “replicas”, indicating that the database they connect to is read-only.

For now this just means they’re ignored by database tasks like db:create, but the comments on the pull request mention some other features that could be built on top of this change.

Reduce allocations during parameter filtering

Initially this patch looked like a micro-optimisation, but the author produced a benchmark which demonstrated saving 1% of both memory and time on a real world Rails app.

Find inverse associations with plural names

Previously, inverse associations would only be detected when they matched the model name exactly. Now, the case where they use the plural form of the model name will work too.

Clear mutation tracker after yielding in around callbacks

This change ensures that a record’s view of the database is up to date immediately after an around callback yields, just as it would be in an after callback.

21 people contributed to Rails this week; feel free to check out the full list of changes. If you want help out, maybe look for an interesting open issue?

Until next time!

Action Cable testing utilities, bugfixes and more!

Happy Sunday! This is Greg bringing you the latest news about Rails.

The initializers Rake task is moved to Rails::Command

Another Rake task is moved to Rails::Command, so in Rails 6 you will need to call bin/rails initializers instead of bin/rake initializers.

Improve Active Job test helpers

This change adds a queue option to perform_enqueued_jobs, and if it is set, only the specified queue will be performed.

Fix rails routes -c

This PR fixes the issue of rails routes -c UserPermissionsController did not output routes for the corresponding controller, because its name consists of multiple words. 

Action Cable testing

This PR is basically a merge of the actioncable-testing gem into Rails, to provide testing utilities for Action Cable.

Fail more gracefully from Active Storage missing file exceptions

This PR translates service-specific missing object exceptions into one generic ActiveStorage::FileNotFoundError, so the application can fail more gracefully when a missing file is accessed.

Omit BEGIN/COMMIT statements for empty transactions

With this change, if a transaction is opened and closed without any queries being run, the BEGIN and COMMIT statements are omitted to remove the overhead, and make workarounds like save if changed? unnecessary.

Support multiple submit buttons in Active Storage forms

Often times forms have more than one submit button enabling different actions, but before this change, Active Storage used the first submit button of the form, rather than the one the user actually clicked.

28 people contributed to Rails this week. If you also want help out, check out the list of open issues! Until next time!

Cookies with purpose, Array extract! and more

Welcome in this week news edition from Rails world. This is Wojtek bringing you summary of latest activities.

Once Webpacker is the default in rails/master, we’ll be unveiling the alpha version of a brand-new exciting framework for Rails 6.0 😄.

If you can’t wait, help us testing Webpacker integration so it can be merged and mystery revealed.

Add Purpose Metadata to Cookies

Adds purpose metadata to cookies so that the value of one cookie cannot be copied and used as the value of another cookie.

Add Array#extract!

The method removes and returns the elements for which the block returns a true value.

numbers = [1, 2, 3, 4]
odd_numbers = numbers.extract!(&:odd?) # => [1, 3]
numbers # => [2, 4]

Replace rake dev:cache with Rails command

Rake task is now deprecated in favor of “rails dev:cache”

24 people contributed to Rails this week. You can see all the changes here.
Until next time!

Rails 5.2.1, skip caching nil entries and more

Namaste everyone! This is Prathamesh bringing you the latest news from the Rails world with some rain and chai from Pune.

Rails 5.2.1 is out in the wild

Rails 5.2.1 is released. Give it a try and check out all the awesome features.

Better error handling of Active Storage adapters

Now, the Active Storage service adapter names can be lower case or upper case. Also, a nice error message is printed if the service adapter class can’t be loaded.

Support for skipping caching of nil entries

While caching data from external services, sometimes we may get nil values. Most probably we don’t want to cache them. Here is an option skip_nil: true/false to skip caching of such entries.

Fix the issue of build not getting called on extension for has_many association

Earlier, the extended build method was not called properly for the has_many association which was being accepted by using accepts_nested_attributes_for.

This issue is fixed now.

19 people contributed to Rails this week. Four of them contributed for the first time! Do you also want to join them? There might be some open issues you can try tackling?

See all the changes  from last week here and stay tuned for next week. 👋

Rails 5.2.1 has been released!

Hi everyone,

I am happy to announce that Rails 5.2.1 has been released.

CHANGES since 5.2.0

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-256

If you’d like to verify that your gem is the same as the one I’ve uploaded, please use these SHA-256 hashes.

Here are the checksums for 5.2.1:

$ shasum -a 256 *-5.2.1.gem
ce0d3cf1c76afd3a2f8a751542e2ddfe48cf4005d426a09775b944a780ed6d9f  actioncable-5.2.1.gem
a667ecf76d300a8faebc5125c25ddb4e46d9c96496c206eee7e02a79c8c33640  actionmailer-5.2.1.gem
8eb8407ad4c836c46285720b05fa7600bec0327fddc3127b43edf2987a4cfba7  actionpack-5.2.1.gem
ae45abf777e829e31c6d3a66f43ed792a657b91fe9b5f322f1f63e7bb4b4aa37  actionview-5.2.1.gem
79383a8dad75cf39677a0096109fc9dcf61cfcf1ef39aeddf2347486c03f94d4  activejob-5.2.1.gem
a45939b9b0e23225d81786519dda2f1ba9f1568012682aa344d8b1e154b77610  activemodel-5.2.1.gem
ef3c520c782d5e51ee67231d4b6167db0166d4b451d0c835e0577eb89967875d  activerecord-5.2.1.gem
4ff9bba1a317bfbc5cd9349bb4e00f6e0aff76d237d68a71ad524b92e0c8cc72  activestorage-5.2.1.gem
829a480f2cf3747b5e94429d983dfb1645a27d506b365642d08ecc3066373e7e  activesupport-5.2.1.gem
776cfea45140972f1780236748f7cfe72cf95c032056812128433273c366078c  rails-5.2.1.gem
1ba71ee5ec7d85567f9984df1dae2eb7e6c8c2855e6b810582719fb5db20c3a7  railties-5.2.1.gem

As always, huge thanks to the many contributors who helped with this release.

Rails 5.2.1.rc1, faster parallel testing and more

Hello everyone! This is Roque, with the latest news about Ruby on Rails!

Help test Rails 5.2.1.rc1

Help us test this release candidate to have a solid and stable 5.2.1.

Faster parallel testing

Instead of running database migrations for each set of tests, Rails will load the schema to improve performance.

Raises exception when respond_to is called multiple times

An exception will be raised when respond_to is called multiple times in an incompatible way. For example, when the Content-Type values do not match.

Set a default Content-Type for the method head

The method head will have Content-Type as text/html when one is not provided.

Fix the IP address logged by Rails

It will now log the remote IP address of clients behind a proxy instead of the IP of the proxy itself.

23 people contributed to Rails this week. You can see all the changes here. There might be some open issues you can try tackling?

Stay tuned!

Rails 5.2.1.rc1 has been released!

Hi everyone,

I am happy to announce that Rails 5.2.1.rc1 has been released.

If no regressions are found, expect the final release on Monday, August 6, 2018. If you find one, please open an issue on GitHub and mention me (@rafaelfranca) on it, so that we can fix it before the final release.

CHANGES since 5.2.0

To view the changes for each gem, please read the changelogs on GitHub:

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-256

If you’d like to verify that your gem is the same as the one I’ve uploaded, please use these SHA-256 hashes.

Here are the checksums for 5.2.1.rc1:

$ shasum -a 256 *-5.2.1.rc1.gem
cf26a51b6483ce88c352687207557825b5ce22d45276f7b4f1168ef71275c5bb  actioncable-5.2.1.rc1.gem
733f8e2aa203ef83c1bcbc0ffa316b9fafeac8ea5c95dbfc41ec4af440fb8466  actionmailer-5.2.1.rc1.gem
9858e240e67a35fcfed8d87673ec496d3d2bd970d00fd6414d922772bed06460  actionpack-5.2.1.rc1.gem
cf68f757d8d71aee003889d8fd49a9f44d0ed348cd07a3ab34c953310f785565  actionview-5.2.1.rc1.gem
ad4575d404c1339c3782ad55976ab40b123e8217fbebfffc579e56f91b7c9bf1  activejob-5.2.1.rc1.gem
e1ee68dd9a8e659cbc523a1d0972b8fc4344ecab5a85aec7a7280d33a66076a4  activemodel-5.2.1.rc1.gem
e184d5b709e0e8351fa32485f63353272a41505b1dbf30c6034a60be321804b1  activerecord-5.2.1.rc1.gem
04b99f581620933447f10e0e9f8964863994962b3c4580e8c0103b9e3bd5ee18  activestorage-5.2.1.rc1.gem
f19afc75fa8527b850b12c343cd4e94b7d4d81f0de7126b03912db591789e167  activesupport-5.2.1.rc1.gem
78fbe88491b0a68f9fe68d7dd8594e2bc102c1aed99a5c5e8acca87e2ec914e7  rails-5.2.1.rc1.gem
a17f0d61e8da7970c19b98f95196d27115be7603a9badfedccd1329b2daffc93  railties-5.2.1.rc1.gem

As always, huge thanks to the many contributors who helped with this release.