Commit Graph

81276 Commits

Author SHA1 Message Date
Rafael Mendonça França 8d6073da7d
Some stylistics changes 2021-08-17 22:18:30 +00:00
Rafael Mendonça França 3597afc605
Avoid using class_eval and just include a module 2021-08-17 22:16:06 +00:00
Rafael Mendonça França 051a086f46
Document query tags configs 2021-08-17 22:14:16 +00:00
Rafael Mendonça França e214f25463
Do not change the framework if all we want are configs
The value of the configs in the base classes were not being used in
the code. We only needed configs, so we can just use that.
2021-08-17 22:13:00 +00:00
Ryuta Kamizono 6f519dc944
Merge pull request #43024 from p8/guides/activerecord-querying-replace-orders_count
Avoid `orders_count` in Active Record `order` guide examples
2021-08-18 00:26:13 +09:00
Petrik 33114544db Avoid `orders_count` in Active Record `order` guide examples
The ordering examples use `Customer#orders_count` for ordering which
results in beginner-unfriendly examples like:

  Customer.order(:orders_count)

Having two unrelated types of `order` can be confusing.
As Customer has many Orders it's probably better to replace the Customer
with Book to avoid any confusion.

Not having `orders_count` also makes it easier to grep for 'order' in
the guide. This also is a reason the `Order.none` example is replaced
with `Book.none`, besides it being more consistent with the example
below it.

Co-authored-by: Ryuta Kamizono <kamipo@gmail.com>
2021-08-17 17:16:06 +02:00
Ryuta Kamizono 0f94833871
Merge pull request #43032 from koic/enable_minitest_unreachable_assertion_cop
Tweak unreachable assertion tests in the block of `assert_raises`
2021-08-17 23:33:51 +09:00
Eileen M. Uchitelle efaeca94e6
Merge pull request #43034 from eileencodes/add-new-kwarg-configs_for
Replace kwarg for displaying all configurations
2021-08-17 10:03:27 -04:00
eileencodes 9da8fef162
Replace kwarg for displaying all configurations
In #42794 we added the ability to hide some configurations for database
tasks. This is useful if you want your application to connect to a
database but if it's a separate service not run any tasks against it.

After adding this functionality I realized that the `configs_for`
argument no longer makes sense. `include_replicas` would include all of
them but ones with `database_tasks: false` aren't necessarily replicas.

This change deprecates `include_replicas` in favor of `include_hidden`
which will display all configurations. When not passed, this will
continue to return all writing connections that we want to perform tasks
on.
2021-08-17 09:27:18 -04:00
Koichi ITO 65af100ddd Tweak unreachable assertion tests in the block of `assert_raises`
I found an unexpected use of assertion in the block of `assert_raise`
when I implemented https://github.com/rubocop/rubocop-minitest/pull/137.
It is expected to be asserted after an exception is raised in
`assert_raise` block, but in actually it is not asserted after an
exception is raised. Therefore, this PR removes or updates assertions
that have not been asserted after an exception has raised.

This PR will add `rubocop-minitest` and enable
`Minitest/UnreachableAssertion` cop to able similar auto-detection,
but will remove `rubocop-minitest` from this PR if you don't like it.
2021-08-17 20:33:08 +09:00
Xavier Noria 1f566bd9ba
Merge pull request #43028 from rails/classic
Do not hook the classic autoloader anymore
2021-08-17 06:51:00 +02:00
Xavier Noria 667660f2e8 Documents config.autoload_once_paths 2021-08-17 06:33:10 +02:00
Ryuta Kamizono 49fee6572c Fix typo [ci skip] 2021-08-17 12:41:08 +09:00
Xavier Noria 2306a8e645 Setup the once autoloader on bootstrap 2021-08-17 05:23:51 +02:00
Xavier Noria 6ee025ad44 Deletes the initializer `ensure_autoload_once_paths_as_subset`
There is no need for this nowadays. you could have a directory somehwere
that is not in autoload_paths, but you want the once loader to manage.

At the same time, when we setup the main loader, we remove any directory
in the autoload_once_paths, since Zeitwerk does not allow loaders to
have overlapping root directories.
2021-08-17 05:18:22 +02:00
Xavier Noria d7e7948789 Deletes the initializer `warn_if_autoloaded` 2021-08-17 05:18:22 +02:00
Xavier Noria bbe74a8c97 Delete AS::Dependencies.unhook! 2021-08-17 05:18:22 +02:00
Xavier Noria 2a22b4c53b Delete AS::Dependencies.hook! 2021-08-17 05:18:22 +02:00
eileencodes dfef44716a
Fix rubocop and cleanup test
Followup to #42794. This fixes a rubocop failure for the spacing before
the curly brace and uses a more common/correct approach to testing the
error message.
2021-08-16 15:30:14 -04:00
Eileen M. Uchitelle 86aeadc481
Merge pull request #42794 from westonganger/multi_db_config_database_tasks_option
Add database config option `database_tasks: false`
2021-08-16 15:29:29 -04:00
Weston Ganger a77dd104ea Implement db config option `database_tasks: false` 2021-08-16 11:18:49 -07:00
Kasper Timm Hansen 13a714f30d
Merge pull request #42979 from DRBragg/drbragg/add-weekday-select
Add `weekday_options_for_select` method
2021-08-16 19:25:46 +02:00
Drew Bragg 592570f1bf Add `weekday_options_for_select` method
Add `weekday_select` method

Create `Tags::WeekdaySelect` class

Add `weekday_select` to `FromBuilder`

Add Documentation

Allow `WeekdaySelect` to use selected option if value is nil

Doc fix

Add tests

Use kwrd args

Update CHANGELOG

Fix `Tags::WeekdaySelect` for updated kwrd args

Update CHANGELOG format

Condense `weekday_options_for_select` method

Update tests for kwargs
2021-08-16 13:04:33 -04:00
Kasper Timm Hansen ef65eeef08
Merge pull request #42960 from FestaLab/activestorage/unsafe-redirect
Fix open redirects in active storage
2021-08-16 15:29:52 +02:00
Kasper Timm Hansen 7faf8a0fe3
[ci skip] Undocument send_blob_byte_range_data, don't commit to a public API just yet 2021-08-16 15:16:54 +02:00
Kasper Timm Hansen fe4ec2ac0c
Merge pull request #41437 from tomprats/active-storage-byte-range
Added Active Storage support for byte ranges
2021-08-16 15:13:45 +02:00
Ryuta Kamizono 01244284cf
Merge pull request #43007 from FestaLab/activestorage/tiff-size
Reduce file size of tiff image in Active Storage
2021-08-16 18:52:43 +09:00
Eugene Kenny f1229b8fbc
Merge pull request #43013 from basecamp/encryption-store-attributes
Make active record encryption work with store attributes
2021-08-15 22:57:46 +01:00
Eugene Kenny a2a399c6ae
Merge pull request #43021 from basecamp/encryption-lenght-validation
Minor improvements to Encryptable records
2021-08-15 22:44:06 +01:00
Jorge Manrubia 6eb4ee4bed Encryption scheme is commong (no need to instantiate 1 per attribute)
See https://github.com/rails/rails/pull/43009#discussion_r689068941

Remove `table_exists?` check that became unnecessary after #43009

Co-authored-by: Haroon Ahmed <haroon.ahmed25@gmail.com>
2021-08-15 23:20:39 +02:00
Jorge Manrubia 24f2502dc0 Remove `table_exists?` check that became unnecessary after #43009
Co-authored-by: Haroon Ahmed <haroon.ahmed25@gmail.com>
2021-08-15 23:20:31 +02:00
Jorge Manrubia 34ac8fc1f1 Make active record encryption work with store attributes
Fix: https://github.com/rails/rails/issues/43012
2021-08-14 11:06:51 +02:00
David Heinemeier Hansson 6ec669b65d
Action Text installer should assume importmap for asset pipeline (#43011)
* Action Text installer should assume importmap for asset pipeline

* Fix test
2021-08-13 14:43:06 +02:00
David Heinemeier Hansson a2cd0a57f7
Ensure image processing gem is enabled when turning on action text so image uploads work out-of-the-box (#43010)
* Ensure image processing gem is enabled when turning on action text so uploads will work

* Test enabling image_processing gem

* Fix rubocop issue
2021-08-13 14:05:23 +02:00
David Heinemeier Hansson a2a28e6c90 Switch to ESM compatible build of trix
The mirror setup isn't doing what we need to get a ESM-compatible version of Trix. So grab a build from Snowpack that's compatible for now.
2021-08-13 11:10:05 +02:00
Jean Boussier 02d989e72c
Merge pull request #43009 from basecamp/encryption-lenght-validation
Move length-validation for encrypted columns after schema is loaded
2021-08-13 10:17:23 +02:00
Kasper Timm Hansen 0965b67bf7
Merge pull request #42967 from p8/main
Clean up missing dots in changelogs
2021-08-13 02:24:40 +02:00
Jorge Manrubia f0fe547e20 Move length-validation for encrypted columns after schema is loaded
Doing it before meant it required a database connection at class loading
time, which was a source a trouble.

See https://github.com/rails/rails/pull/42991#discussion_r687659296
2021-08-12 22:52:50 +02:00
Rafael França c84dec3513
Merge pull request #43006 from composerinteralia/journey-root-node-methods
Restore the behavior of journey root node methods
2021-08-12 13:33:59 -04:00
Breno Gazzola b4e394767d Reduce file size of tiff image in Active Storage 2021-08-12 11:37:44 -03:00
Daniel Colson 754ed1f45b
Restore the behavior of journey root node methods
https://github.com/rails/rails/pull/39935 changed the behavior of
`Path::Pattern#spec` and `Route#ast` to return an `Ast` rather than the
root `Node`. After eager loading, however, we clear out the `Ast` to
limit retained memory and these methods return `nil`.

While these methods are not public and they aren't used internally after
eager loading, having them return `nil` makes it difficult for
applications that had been using these methods to get access to the
root `Node`.

This commit restores the behavior of these two methods to return the
root `Node`. The `Ast` is still available via `Path::Pattern#ast`, and
we still clear it out after eager loading.

Now that spec is a `Node` and not an `Ast` masquerading as one, we can
get rid of the delegate methods on `Ast.

Since `Route#ast` now returns the root `Node`, the newly added
`Route#ast_root` is no longer necessary so I've removed it.

I also removed the unused `@decorated_ast` method, which should have
been removed in https://github.com/rails/rails/pull/39935.
2021-08-12 09:51:38 -04:00
Ryuta Kamizono b669e87071 Enforce standardizing nodoc comments by rubocop
Follow up to 18707ab1, b87d8e51.

rubocop 1.19.0 includes https://github.com/rubocop/rubocop/pull/9964.
2021-08-12 20:01:37 +09:00
David Heinemeier Hansson 21c9732fae
Remove spring as a default installation option (#42997)
* Remove spring as a default installation option

Faster computers have meant that most apps won't see a big benefit from Spring on small to moderate size apps. Thus the pain of dealing with the occasional spring issue is no longer warranted by default.

* Errant end

* No longer an option

* Additional spring removals

* Pointer to docs is enough
2021-08-12 12:31:18 +02:00
Eileen M. Uchitelle da911da970
Merge pull request #43000 from markets/markets-patch-1
Remove docs of now gone --skip-gemfile
2021-08-11 14:36:14 -04:00
Marc Anguera 51cebff059
Remove docs of now gone --skip-gemfile [skip ci]
Related to #42996.
Similar to 8d1b8e870c
2021-08-11 17:37:15 +02:00
David Heinemeier Hansson 8d1b8e870c Remove test and docs of now gone --skip-puma 2021-08-11 16:35:15 +02:00
David Heinemeier Hansson da22dcc0e9
Puma is the only option used for the web server (#42998)
Doesn't make sense to remove the configuration needed as an option any more.
2021-08-11 16:22:23 +02:00
David Heinemeier Hansson d9eeedf84f
Legacy option from the days of Bundler opposition (#42996)
Don't have to keep all the monuments to old skirmishes around forever.
2021-08-11 15:45:44 +02:00
David Heinemeier Hansson e34300a921
Stop trying to configure listen by default on compatible platforms (#42985)
* Stop trying to configure listen by default on compatible platforms

Modern computers with SSDs don't see much/any benefit from having an evented file update watcher. Remove complexity by taking this spinning-drive concession out.

* Actually need listen for testing the opt-in

* Test no longer relevant
2021-08-11 15:18:43 +02:00
Jean Boussier ea2c5ec0b9
Merge pull request #42995 from Shopify/internal-metadata-timestamps
Set record_timestamps = true in AR::InternalMetadata
2021-08-11 14:56:08 +02:00