Commit Graph

81345 Commits

Author SHA1 Message Date
Xavier Noria
627037fa8b Delete AS::Dependencies.depend_on 2021-08-18 22:24:08 +02:00
Xavier Noria
cb0c746b7d Revises the autoloading guide [skip ci] 2021-08-18 21:37:50 +02:00
Rafael Mendonça França
cabe311f67
Make DatabaseConnectionError a subclass of ConnectionNotEstablished
Before the introduction of this exception, we where raising
a `ConnectionNotEstablished` and users might be rescuing that exception
already.

As the goal of the new exception was to be more specific, we should be
subclassing `ConnectionNotEstablished` to keep the old behaviour.
2021-08-18 18:44:52 +00:00
Xavier Noria
4b4895e60d Tweaks wording in guide [skip ci]
The way it was written, it was not 100% clear if that was the name
to choose or the one to avoid.
2021-08-18 09:14:21 +02:00
Rafael Mendonça França
614fc3d827
Delay the exclusion of the configs to the last minute
The framework still rely on the configuration object being modified
in initializers, so we need to delay the exclusion to the last minute.
2021-08-18 00:04:25 +00:00
Rafael Mendonça França
3ca36fb9ef
Fix action_on_unpermitted_parameters setter
If the falue is false we should not try to calculate it.
2021-08-17 23:40:55 +00:00
Rafael Mendonça França
bc00484d2c
No need to check if the logs are enable to run those tests 2021-08-17 23:35:49 +00:00
Rafael Mendonça França
ac77ab469f
Only try to configure the query log tags if Active Record is present 2021-08-17 23:35:47 +00:00
Rafael Mendonça França
a6aa9376f1
Stop relying on mutating the configuration object 2021-08-17 23:35:46 +00:00
Rafael Mendonça França
8af78700d2
Improve taggings API by introducing a null object
Instead of adding chains of `&.` we should use a null object to allow
the taggings definition to be more concise.
2021-08-17 23:35:44 +00:00
Rafael Mendonça França
18cd634e07
Fix initialization proccess of the query tags
The tags were being added in the wrong way, now it is always using the
configuration.
2021-08-17 22:59:44 +00:00
Rafael Mendonça França
16242464db
Allow tag values to be static 2021-08-17 22:59:24 +00:00
Rafael Mendonça França
1e3e1a0e72
No need for memoization
At this point the application name can't change.
2021-08-17 22:41:03 +00:00
Rafael Mendonça França
84376c3e03
Move default tagging configuration to the railtie
All other tags are there, so there is no need to keep them separated.
2021-08-17 22:38:27 +00:00
Rafael Mendonça França
6d983e86da
Remove more unneeded methods that should be configs 2021-08-17 22:35:22 +00:00
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