We convert all other scopes to lambda's so it makes sense that we should
always returns a lambda on a ThroughReflection as well. This eliminates
the need to check if the scope is a Relation.
Closes#17945
`db:test:prepare` still purges the database to always keep the test
database in a consistent state.
This patch introduces new problems with `db:schema:load`. Prior
to the introduction of foreign-keys, we could run this file against
a non-empty database. Since every `create_table` containted the
`force: true` option, this would recreate tables when loading the schema.
However with foreign-keys in place, `force: true` wont work anymore and
the task will crash.
/cc @schneems
Conflicts:
activerecord/CHANGELOG.md
There is no need to subtract one from the path_params size when there is
no format parameter because it is not present in the path_params array.
Fixes#17819.
(cherry picked from commit 1a50be8231)
Conflicts:
actionpack/CHANGELOG.md
actionpack/lib/action_dispatch/routing/route_set.rb
bring back `db:test:prepare`.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/migration.rb
This also includes the initializer-order-fix for Active Record
configurations. This patch breaks oracle-enahnced-adapter.
/cc @rafaelfranca @yahonda
PostgreSQL for example, allows infinity as a valid value for date time
columns. The PG type has explicit handling for that case. However, time
zone conversion will end up trampling that handling. Unfortunately, we
can't call super and then convert time zones.
However, if we get back nil from `.in_time_zone`, it's something we
didn't expect so we can let the superclass handle it.
Backport of 42418cfc94 and
65588b7463Fixes#17971
All of the behavior :environment was giving (that db:schema:load needed)
was provided as well with :load_config.
This will address an issue introduced in
https://github.com/rails/rails/pull/15394. The fact that db:schema:load
now drops and creates the database causes the Octopus gem to have [an
issue](https://github.com/tchandy/octopus/issues/273) during the drop
step for the test database (which wasn't happening in db:schema:load
before). The error looks like:
ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: cannot drop the currently open database
: DROP DATABASE IF EXISTS "app_test"
Because of the timing, this issue is present in master, 4-2-*, and
4.1.8.
A note to forlorn developers who might see this: "Additionally" in a
commit message means you should have a separate commit, with a separate
justification for changes. Small commits with big messages are your
friends.
This `# :nodoc:` had the effect of hiding every method that follows.
This meant that the API page for `ActiveRecord::Core` only contained
`configurations` and none of the following methods.
Furthermore this `# :nodoc:` had no effect on `maintain_test_schema`.
Those `mattr_accessor` inside the `included` block are not picked up
by rdoc.
/cc @zzak