4

Riding Rails

 3 years ago
source link: https://weblog.rubyonrails.org/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Riding Rails

Hello, zzak again with the latest changes in Rails this week!

DHH previews modern web apps without JavaScript bundling or transpiling

In this YouTube, DHH goes through the latest changes planned for Rails 7 and how the face of front-end development has evolved.

Rails 6.0.4.1 and 6.1.4.1 have been released

A reminder to upgrade to the latest stable versions of Rails which includes a critical security fix for Action Pack.

Dropping support for classic mode

There’s an ongoing epic to delete the classic autoloader that started months ago. Let’s do a checkpoint in this newsletter.

You can no longer opt-in to classic mode using config.autoloader=, this setter has been deleted, Rails 7 has only one autoloading backend: Zeitwerk.

During application initialization, you can autoload classes and modules from config.autoload_once_paths, but autoloading reloadable constants doesn’t work anymore. That has been deprecated and issuing warnings since Rails 6.0. Check the documentation for valid ways to do that.

Additionally, a lot of private APIs and orphan code fall in cascade. Check for example #43048 and #43058, and there’s more to come.

Add new form builder “weekday_options_for_select”

This PR adds a helper for weekday select which even includes i18n!

Support for byte ranges in Active Storage

This PR allows serving uploads in chunks in order to stream buffered files as is required e.g. audio podcasts from S3 to an iphone.

Add database config option to turn off tasks like db:migrate

In a multidb configuration you may have a database that you want to connect to, such as a replica, but don’t want to accidentally run any db tasks on it.

The “database_task: false” config flag ensures you don’t accidentally “rails db:drop” your backup database.

Remove legacy –skip-gemfile option

“Don’t have to keep all the monuments to old skirmishes around forever.”

Remove –skip-puma option

Since puma is the only option available for the web server, it doesn’t make sense to allow removing it as a configuration option.

15 people contributed to Rails since last time. All the changes can be checked here. Until next week!

Rails 6.0.4.1 and 6.1.4.1 have been released

Posted by tenderlove, August 19, 2021 @ 4:40 pm

Hi everyone! Rails versions 6.0.4.1 and 6.1.4.1 have been released!

These releases contain important security fixes, so please update when you can! This release just contains one security fix which you can read about here:

Here are the checksums for the gems:

$ shasum -a 256 *-6.0.4.1.gem 
390edd2a66448c4ba8686c11514be45264e995304cd05095d5bc5e55126e68ef  actioncable-6.0.4.1.gem
7ea740274387f1b955a6f23288baac88c3e6eb8543a98d825efec9105b850b61  actionmailbox-6.0.4.1.gem
357e32b4a17ce9e85f068d90f9ca841cab7f8c37d667cd3ddcc5330e01aeb1db  actionmailer-6.0.4.1.gem
6fa124867dabefa977f64f30005ed918a71fe6d745b1bb6f0fbd05bef2767a03  actionpack-6.0.4.1.gem
9466887c902c791b7b716b6d5169d9f02487cb0ac8bea54fe6e37b7d2e19df03  actiontext-6.0.4.1.gem
ffdde2003358f64a14d8687b3d7bc30c0566f1b74cfe82848c9b99609f5800a8  actionview-6.0.4.1.gem
71744dc6d49a89c64124ce660b48528a1783f508384112f532c1ced009998d64  activejob-6.0.4.1.gem
3753fb5dfd6d7152ceaec361fea4aee2da7f43cc0004718c16b282d139aae5c8  activemodel-6.0.4.1.gem
a0e4e861767c5b38252dbfd040b0f786a80d8794e021fb0f32e75065f71a066c  activerecord-6.0.4.1.gem
a5d08d6ce17cadae0977ab9b3629334076343575d0f20438093b3574c82cd0bc  activestorage-6.0.4.1.gem
33093c89f35db3200d3cb161252e95322e6fd8f46419e98ac712a5d01445913f  activesupport-6.0.4.1.gem
62f6b50573e2afc305575f580ed72783512874464726d8e52fe8c10b981d1ee0  rails-6.0.4.1.gem
e4743f2aaa895962f94c1d6777daffff3fb578818a1544d58e5a40a76d27856c  railties-6.0.4.1.gem
$ shasum -a 256 *-6.1.4.1.gem 
5d7cca7aefeee6ea95003f32786196749c9b6c92f8a96937fda066156d2d9846  actioncable-6.1.4.1.gem
06e39f90ad0da00acf860265188c438b74fa96aa69990216652508cda56d5f99  actionmailbox-6.1.4.1.gem
229525238eeba137d9ecdc6c331fac07c76a2305ea66f102642f16a6043d4003  actionmailer-6.1.4.1.gem
2a5e0af9f561e8b7f27b1f4088a3d6d4283ec7eaa283f0db345ecb152dd6fe75  actionpack-6.1.4.1.gem
02953e65adb6805e0279ffaf44f4faceb4e89adc038d0ed7b73b018831f18e54  actiontext-6.1.4.1.gem
7f08294f1f0e39ea9db211bafedbded068223abf54659581ce440c3a0b8bc4f9  actionview-6.1.4.1.gem
169e7cf2d9ecad34db8199c2da577e853c6a65523c9cd9177b3d2b3e4104ece0  activejob-6.1.4.1.gem
032f5bbe1fc88aa2fb4db97807026c01fe1a41571672d01f2d0b454b49553d9a  activemodel-6.1.4.1.gem
4a22709593cf8e164939286bc1635efcd87378244ad17e87becb1f7324dd8fb1  activerecord-6.1.4.1.gem
716fdda141aa3a9c027f59d0effb08cbf5291fad1df82d50e9e4e1edd2ff769e  activestorage-6.1.4.1.gem
44b781877c2189aa15ca5451e2d310dcedfd16c01df1106f68a91b82990cfda5  activesupport-6.1.4.1.gem
7f5dd7a71046aedb6859eb4288b31b738fb8544bd9fb27574085b58cbaa8a9f8  rails-6.1.4.1.gem
7e03a6b27a1ab455e9d9c52b6dfb1cae34065ea04382272e19da63860ca897cf  railties-6.1.4.1.gem

Have a great day! 😬

-Aaron ❤️

ESM importmap and Marginalia

Posted by morgoth85, August 13, 2021 @ 12:00 am in News

Hi, Wojtek here introducing you to upcoming Rails 7 goodies.

ESM importmap support

Modern web apps without JavaScript bundling or transpiling are now possible to build in Rails. Exciting new direction of frontend tooling, that most likely Rails 7.0 will aim. Introduced by DHH in this post.

Port Marginalia gem to Rails

Configurable tags can be automatically added to all SQL queries generated by Active Record. By default the application, controller and action details are added to the query tags, like this:
SELECT * FROM books /*application:MyApp;controller:books;action:index*/

Add multi db setup and reset tasks

Added support for multiple databases to rails db:setup and rails db:reset. Now those tasks can be run per database, like rails db:setup:primary.

No Spring in default stack

Faster computers have meant that most apps won’t see a big benefit from Spring on small to moderate size apps.

16 people contributed to Rails since last time. All the changes can be checked here. Until next week!

Active Record goodies and more!

Posted by gregmolnar, August 8, 2021 @ 12:00 am in News

Hi there, this is Greg, bringing you the latest new about the Rails framework.

Allow entirely opting out of deprecation warnings

Previously if you set app.config.active_support.deprecation = :silence, some work would still be done on each call to ActiveSupport::Deprecation.warn, which had computing cost, but from now on, you can disable it completely.

Output Action Cable Javascript without transpiling and as ESM

This PR updates all the Rails Javascript to target ES2017 and ESM, as far as is possible. This makes it easier to use these outputs directly in browsers without bundling, yet still use ESM module.

Create database via UI when ActiveRecord::NoDatabaseError

This PR adds the possibility to create the database via the UI when database has not been created in development mode.

Add ActiveRecord::QueryMethods#in_order_of

#in_order_of allows you to specify an explicit order that you’d like records returned in based on a SQL expression, for instance: Post.in_order_of(:id, [3, 5, 1])

Add ActiveRecord::Relation#structurally_compatible?

#structurally_compatible? can be used to check if the relation that you are about to use for #or or #and is structurally compatible with the receiver.

20 people contributed to Rails since last time. All the changes can be checked here. Until next week!

Hello, zzak here! Congrats on making it through another month and another week of Rails development.

Add favicon to internal routes “/favicon.ico”

They finally fixed that pesky No route matches [GET] "/favicon.ico" error on the default Rails welcome page.

Introduce Journey::Ast to avoid extra ast walks

This PR started its journey almost exactly a year ago…!

Improve help for Rake tasks

Rails help command now includes the Rake task description which is much more helpful. Give it a try: bin/rails db:migrate -h!

Help identifying why we have an InvalidAuthenticityToken exception

Unverified CSRF requests now display a helpful error message in the ActionController::InvalidAuthenticityToken exception.

“Middleware#remove” is renamed “Middleware#delete!”

Recently “Middleware#remove” was added to mirror the behavior of “Middleware#delete” but raise an exception if the middleware isn’t found. This name makes more sense as “#delete!”.

Add support for defining default values as option for ActiveSupport::Configurable accessors

This PR adds the ability to specify a default value when using “config_accessor”.

Permit attachments in inbound email conductor mail params

This PR fixes an issue in actionmailbox when testing inbound email with attachments.

29 people contributed to Rails since last time. All the changes can be checked here. Until next week!

Hi, Wojtek here presenting quite a lot of changes from the past week.

Disable schema dump per database

Dumping the schema is on by default for all databases in an application. To turn it off for a specific database one can now set schema_dump: false in the database config file.

Add change tracking methods for belongs_to associations

Two new methods were added: association_changed? and association_previously_changed? (assuming an association named :association) to Active Record.

Raise error on unpermitted open redirects

Add allow_other_host options to redirect_to. One can opt in to this behaviour with ActionController::Base.raise_on_open_redirects = true.

Update Capybara drivers

Deprecate poltergeist and webkit (capybara-webkit) driver registration for system testing (they will be removed in Rails 7.1) and add cuprite instead.

Fix dirty check for Float::NaN and BigDecimal::NaN

Float::NaN and BigDecimal::NaN in Ruby are special values and can’t be compared with == method.

Make ActiveModel::Errors#inspect slimmer for readability

It will now only output the errors inspection omitting the base object.

Add Middleware#remove

It will raise an error if the middleware is not found.

24 people contributed to Rails since last time. All the changes can be checked here. Until next week!

Hi, this is Greg, bring you the latest news of the Rails world. It’s been a quiet week, so we don’t have much changes to cover this time.

Fix try and try! performance slowdown in Ruby 2.7+

This PR fixes a performance regression in try and try! under ruby 2.7+.

Fix eager_loading? when ordering with Hash syntax

After this change, eager_loading? is triggered correctly when using order with hash syntax on an outer table, instead of raising an error.

Parallelize tests only when there are enough to justify the parallelization overhead

Parallelizing tests has a cost in terms of database setup and fixture loading. This change makes Rails disable parallelization when the number of tests is below a configurable threshold.

29 people contributed to Rails since last time. All the changes can be checked here. Until next week!

Hi, zzak again with the changes from the last week in Rails.

Rails 6.1.4 was released

This release includes many bug fixes so be sure to upgrade! You can read the full summary of changes here.

Deleting an item from the Middleware stack should raise if the item is not found

A bug was fixed when trying to remove a non-existent middleware off the stack.

Generators should raise an error if an attribute has an invalid index

An error is now raised in bin/rails when trying to generate a model with a misspelled “index” attribute.

config_for accepts root shared as an array

A bug was fixed when using config_for with a shared config that is defined as an array.

Handle error when file does not exist at filepath

A more helpful error message is given when using render: file for a non-existent absolute path.

Handle paths with spaces when editing credentials

This issue identifies a bug with trying to use bin/rails credentials:edit on Windows.

Truncate more ActionCable broadcast messages to 300 chars

This PR is a follow-up to an older PR that tried to cut down on ActionCable logging noise in development.

Verify foreign keys after loading fixtures

This PR introduces a new feature where referential integrity is applied to associations when loading fixtures.

It only works for SQLite and Postgres for now, if anyone has idea how to make this work in MySQL.

20 people contributed to Rails since last time. All the changes can be checked here. Until next week!

Hello. News about latest changes in Rails delivered to you by Wojtek.

Active Record destroy_all performs in batches

By default it will load records in batches of 100 and allow to specify the custom batch size.

Add support for ordinal date values

A valid ordinal value will be converted to an instance of TimeWithZone.
In example “21087” value will be parsed to 28-03-2021 date.

Add existence check to foregin key migrations

It is now possible to use if_exists / if_not_exist on remove_foreign_key / add_foreign_key in database migrations.

Add possibility to configure Active Storage for Action Mailbox

It is now possible to configure Active Storage service for storing email raw source via config.action_mailbox.storage_service.

Support strict_loading_by_default in Active Storage

Before the patch, Active Storage representation objects did not play nice with strict loading configuration.

Replace uglifier with terser

Terser is more up to date with modern javascript features, and the uglifier gem repository recommends using it for minifying ES6+ code.

32 people contributed to Rails since last time. All the changes can be checked here. Until next week!

Hi there, this is Greg, bringing you the latest changes in Rails!

Time#change should pass the zone property through if it’s set

This PR fixes an issue with changing date objects when the zone is set.

Fix number_to_currency to avoid negative format when displaying zero

This PR fixes number_to_currency to avoid negative format when displaying zero. Before this change, number_to_currency(-0.00456789, precision: 2) _returned _$-0.00

Support preloads on instance dependent associations

From now on instance dependent associations are supporting preloading. To get more details about this change, read the PR descriptions, it explains it really well.

37 people contributed to Rails since last time. All the changes can be checked here. Until next week!

← Previous


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK