Commit Graph

81254 Commits

Author SHA1 Message Date
Xavier Noria 4ba449aafb Delete AS::Dependencies.loaded 2021-08-18 23:25:49 +02:00
Xavier Noria 46576a4555 Delete AS::Dependencies.history 2021-08-18 23:25:49 +02:00
Xavier Noria 5102fdeacf Delete AS::Dependencies.remove_constant 2021-08-18 23:25:49 +02:00
Xavier Noria 2b31655493 Delete AS::Dependencies.new_constants_in 2021-08-18 23:25:49 +02:00
Xavier Noria e24ae73021 Delete AS::Dependencies.qualified_name_for 2021-08-18 23:25:49 +02:00
Xavier Noria 1b92154ff4 Delete AS::Dependencies.autoload_module! 2021-08-18 23:25:49 +02:00
Xavier Noria 7b2223be8b Delete AS::Dependencies.remove_unloadable_constants! 2021-08-18 23:25:49 +02:00
Xavier Noria d3ffcafb14 Delete AS::Dependencies.load_file 2021-08-18 23:25:44 +02:00
Xavier Noria 805067e6d2 Delete AS::Dependencies.loadable_constants_for_path 2021-08-18 23:25:35 +02:00
Xavier Noria 98381b7ba2 Delete AS::Dependencies.require_or_load 2021-08-18 22:44:59 +02:00
Xavier Noria 1343a3a67d Delete AS::Dependencies.load_missing_constant 2021-08-18 22:43:52 +02:00
Xavier Noria 27262897c7 Delete AS::Dependencies::Loadable 2021-08-18 22:31:07 +02:00
Xavier Noria a7a217212b Delete AS::Dependencies::ModuleConstMissing 2021-08-18 22:27:55 +02:00
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