| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* Move check from generated helper to test_help.rb, so that all
applications can benefit
* Rather than just raising when the test schema has pending migrations,
try to load in the schema and only raise if there are pending
migrations afterwards
* Opt out of the check by setting
config.active_record.maintain_test_schema = false
* Deprecate db:test:* tasks. The test helper is now fully responsible
for maintaining the test schema, so we don't need rake tasks for this.
This is also a speed improvement since we're no longer reloading the
test database on every call to "rake test".
|
|\ \ \
| | | |
| | | |
| | | | |
Fix enum writers when using integers
|
| | | |
| | | |
| | | |
| | | |
| | | | |
Add a mention about the automatic generation of scopes based on the
allowed values of the field on the enum documentation.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Previously, the writer methods would simply check whether the passed
argument was the symbol representing the integer value of an enum field.
Therefore, it was not possible to specify the numeric value itself but
the dynamically defined scopes generate where clauses relying on this
kind of values so a chained call to a method like `find_or_initialize_by`
would trigger an `ArgumentError`.
Reference #13530
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Use `Array#wrap` instead `Array()`
|
| | | | |
| | | | |
| | | | |
| | | | | |
- since `Array()` calls `to_ary` or `to_a` on a subject
- the intent is to 'wrap' subject into an array
|
| | | | | |
|
|\ \ \ \ \
| |_|/ / /
|/| | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Fix for #13437
Conflicts:
activerecord/CHANGELOG.md
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
a8 introduced a regression in includes/preloades
by calling `read_attribute` on an association when preloading takes places, instead of using loaded records in `association.target`.
tl;dr
Records are not made properly available via `read_attribute` when preloding in simultaneous,
but value of `@loaded` is already set true, and records concatenated in `association.target` on an association object.
When `@loaded` is true we return an object of `AlreadyLoaded` in preload_for. In `AlreadyLoaded` to return preloaded
records we make wrong use of `read_attribute`, instead of `target` records.
The regression is fixed by making use of the loaded records in `association.target` when the preloading takes place.
Fixes #13437
|
| | | | | |
|
| |/ / /
|/| | |
| | | |
| | | |
| | | | |
Outer joins were being built on the root relation klass rather than the
one specified in the join dependency root
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Currently a developer can pass in a YAML configuration that fully specifies connection information:
```
production:
database: triage_production
adapter: password
pool: 5
```
They can also pass in a string that specifies a connection URL directly to an environment key:
```
production: postgresql://localhost/foo
```
This PR allows the use of both a connection url and specifying connection attributes via YAML through the use of the "url" sub key:
```
production:
url: postgresql://localhost/foo
pool: 3
```
This will allow developers to inherit Active Record options such as `pool` from `&defaults` and still use a secure connection url such as `<%= ENV['DATABASE_URL'] %>`. The URL is expanded into a hash and then merged back into the YAML hash. If there are any conflicts, the values from the connection URL are preferred.
Talked this over with @josevalim
|
|\ \ \ \
| | | | |
| | | | | |
[ci skip] ConnectionSpecification::Resolver Docs
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Document the internal interfaces of `ConnectionSpecification::Resolver`
Change method name from `config` to `env` to better match the most common use case.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
FIXTURES_PATH has a bit different case than DatabaseTasks.fixtures_path,
which was added along with deprecation. A use case for FIXTURES_PATH
could be loading fixtures from a different directory just for a given
test run. The implementation is fairly simple, so leaving it as it is
won't hurt.
|
|\ \ \ \
| | | | |
| | | | | |
Extract db url connection logic to class
|
| |/ / / |
|
|/ / /
| | |
| | |
| | | |
argument
|
| | | |
|
|\ \ \
| | | |
| | | | |
Copy changed_attributes across to newly become'd records
|
| | | |
| | | |
| | | | |
Without this, the original record's values won't get saved, since the partial insertions support (https://github.com/rails/rails/commit/144e8691cbfb8bba77f18cfe68d5e7fd48887f5e) checks for changed values and thinks there are none.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Warning:
DEPRECATION WARNING: Passing a string to ActiveRecord::Base.establish_connection for a configuration lookup is deprecated, please pass a symbol (:development) instead.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Warning:
~/projects/rails/activerecord/lib/active_record/railtie.rb:140: warning: method redefined; discarding old extend_message
~/projects/rails/activerecord/lib/active_record/errors.rb:104: warning: previous definition of extend_message was here
|
|\ \ \ \
| |/ / /
|/| | | |
Typo rectified commom => common[ci skip]
|
| | | | |
|
| | | |
| | | |
| | | | |
Building on the work of #13427 this PR adds a helpful error message to the adapters: mysql, mysql2, and sqlite3
|
| | | | |
|
| | | | |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Do not store production information in .yml files
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit also cleans up the rake tasks that were checking
for DATABASE_URL in different places.
In fact, it would be nice to deprecate DATABASE_URL usage in the long
term, considering the direction we are moving of allowing those in .yml
files.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Always pass in the column for quote_bound_value and quote using it in
case it exists there.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Fixes #12261. Closes #12395.
Conflicts:
activerecord/CHANGELOG.md
activerecord/test/cases/adapters/postgresql/array_test.rb
activerecord/test/cases/adapters/postgresql/json_test.rb
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The code uses these checks in several places to know what to do with a
particular column, for instance AR attribute query methods has a branch
like this:
if column.number?
!value.zero?
end
This should never be true for array columns, since it would be the same
as running [].zero?, which results in a NoMethodError exception.
Fixing this by ensuring that array columns in PostgreSQL never return
true for number?/text? checks.
Since most of the array support was based on the postgres_ext lib, it's
worth noting it does the same thing for numeric array columns too:
https://github.com/dockyard/postgres_ext/blob/v1.0.0/lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb#L72
This extended the same logic for text columns to ensure consistency.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Currently if you attempt to use a database that does not exist you get an error:
```
PG::ConnectionBad FATAL: database "db_error" does not exist
```
The solution is easy, create and migrate your database however new developers may not know these commands by memory. Instead of requiring the developer to search for a solution, tell them how to fix the problem in the error message:
```
ActiveRecord::NoDatabase: FATAL: database "db_error" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
```
Active Record should not know about `rake db:migrate` so this additional information needs to come from the railtie. Potential alternative implementation suggestions are welcome.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Fixes: #13445
|
| | | |
| | | |
| | | |
| | | | |
Closes #13444
|
| | | | |
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
fix CollectionAssociation's comments
|
| | | | |
| | | | |
| | | | |
| | | | | |
AssociationProxy to match changes for 3.1 removing Association proxy.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
quoting: Check if id is a valid method before using it
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Need to check if valud also respond_to :id before calling it, otherwise
things could explode.
|
|/ / / / / |
|
|\ \ \ \ \ |
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
modified regex for finding table_name from a multiline sql query in postgresql
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Previously, executing an insert SQL in PostgreSQL with a command like this:
insert into articles(
number)
values(
5152
)
would not work because the adapter was unable to extract the correct articles table name.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
fix typos and grammar mistake [ci skip]
|