| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Make automatically synchronize test schema work inside engine
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In Rails engine, migration files are in under `db/migrate` of engine.
Therefore, when rake task is executed in engine, `db/migrate` is
automatically added to `DatabaseTasks.migrations_paths`.
https://github.com/rails/rails/blob/a18cf23a9cbcbeed61e8049442640c7153e0a8fb/activerecord/lib/active_record/railtie.rb#L39..L43
However, if execute the rake task under dummy app, migration files will not
be loaded because engine's migration path setting process is not called.
Therefore, in order to load migration files correctly, it is necessary to
execute rake task under engine.
Fixes #30765
|
|\ \
| | |
| | | |
Add update_only example to AR nested attributes doc [ci_skip]
|
| |/ |
|
| |
| |
| |
| | |
Follow up of #30360.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Attribute modules (`Attribute`, `Attributes`, `AttributeSet`) uses
`Type`, but referencing `Type` before the modules still fail.
```
% ./bin/test -w test/cases/attribute_test.rb -n test_with_value_from_user_validates_the_value
Run options: -n test_with_value_from_user_validates_the_value --seed 31876
E
Error:
ActiveModel::AttributeTest#test_with_value_from_user_validates_the_value:
NameError: uninitialized constant ActiveModel::AttributeTest::Type
/Users/kamipo/src/github.com/rails/rails/activemodel/test/cases/attribute_test.rb:233:in `block in <class:AttributeTest>'
bin/test test/cases/attribute_test.rb:232
Finished in 0.002985s, 335.0479 runs/s, 335.0479 assertions/s.
1 runs, 1 assertions, 0 failures, 1 errors, 0 skips
```
Probably we need more autoloading at least `Type`.
|
| |
| |
| |
| |
| |
| |
| | |
`joins_values.partition` will break joins values order. It should be
kept as user intended order.
Fixes #15488.
|
| |
| |
| |
| | |
`CollectionProxy`
|
| |
| |
| |
| | |
Fixes #21577.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
They are only different by one line of code which doesn't deserve a
hierarchy of 7 classes.
Closes #31079.
[Ryuta Kamizono & Bogdan Gusiev]
|
|\ \
| | |
| | | |
Simplify implementation of `MySQLDatabaseTasks`
|
| | |
| | |
| | |
| | |
| | |
| | | |
Don't process MySQL ERROR 1045, raise error instead
Make behavior of `MySQLDatabaseTasks` more consistent with behavior of `PostgreSQLDatabaseTasks`
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`blog$ bin/rails db:create`
Before:
```
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf42", "pool"=>5,
"username"=>"root", "password"=>nil, "socket"=>"/var/run/mysqld/mysqld.sock",
"database"=>"blog_development"}, {:charset=>"utf42"}
(If you set the charset manually, make sure you have a matching collation)
Created database 'blog_development'
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf42", "pool"=>5,
"username"=>"root", "password"=>nil, "socket"=>"/var/run/mysqld/mysqld.sock",
"database"=>"blog_test"}, {:charset=>"utf42"}
(If you set the charset manually, make sure you have a matching collation)
Created database 'blog_test'
```
After:
```
Unsupported charset: '"utf42"'
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf42", "pool"=>5,
"username"=>"root", "password"=>nil, "socket"=>"/var/run/mysqld/mysqld.sock",
"database"=>"blog_development"}
rails aborted!
Mysql2::Error: Unsupported charset: '"utf42"'
...
(stack trace)
...
bin/rails:4:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)
```
Closes #29683
Related to #27398
|
| | |
| | |
| | |
| | |
| | | |
Use these to back the attributes API. Stop automatically including
ActiveModel::Dirty in ActiveModel::Attributes, and make it optional.
|
| | | |
|
| | |
| | |
| | |
| | | |
`through_reflection` and `source_reflection` are used only in the class.
|
|\ \ \
| | | |
| | | | |
Fix `bin/rails db:migrate` with specified `VERSION`
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Ensure that `bin/rails db:migrate` with specified `VERSION` reverts
all migrations only if `VERSION` is `0`.
Raise error if target migration doesn't exist.
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`associated_records_by_owner` had returned customizing result before
calling `associate_records_to_owner` for through association subclasses.
Since #22115, `associate_records_to_owner` is called in the method and
not returned owner and result pairs. Removing the method will reduce
method call and block call nesting.
|
|\ \ \
| | | |
| | | | |
Handle Timeout.timeout in rails queries
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
```
[NoMethodError]: undefined method `state' for nil:NilClass Method:[rescue in block in refresh]
```
In `within_new_transaction`, there is the possibility that
`begin_transaction` returns a `nil`. (i.e.: so `transaction = nil`)
So this method is checking `transaction` for nil in 2 spots.
Unfortunately, there is one line that is not checking `transaction` for `nil`
That line, `commit_transaction`, throws an exception for us in AR 5.0.0.1
The problem with the method is finally realized in the error checking itself.
it calls `transaction.state` (i.e.: nil.state) and that is the final exception
raised.
The actual underlying (user) issue is hidden by this line.
Solution is test transaction for nil.
|
|/ / / |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
A relation includes `klass`, so it can not be used as it is if current
class is different from `current_scope.klass`. It should be created new
relation by current class to respect the klass and STI constraint.
Fixes #17603.
Fixes #23576.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is partially fixed by e617fb57 when through association has already
loaded. Otherwise, second level through association should respect
`preload_scope`.
Fixes #30242.
Closes #30076.
[Ryuta Kamizono & CicholGricenchos]
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
loaded
If through association has already loaded, `source_type` is ignored to
loaded through records. The loaded records should be filtered by
`source_type` in that case.
Fixes #30904.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
eager-loading is needed
If a relation has eager-loading values, `count` and `exists?` works
properly, but `update_all` and `delete_all` doesn't work due to missing
`apply_join_dependency`. It should be applied to work consistently.
Fixes #28863.
|
| | |
| | |
| | |
| | |
| | |
| | | |
is needed
Fixes #30315.
|
| | |
| | |
| | |
| | |
| | |
| | | |
* `HasManyThroughCantDissociateNewRecords` and `HasManyThroughCantAssociateNewRecords`
are no longer used since f6b12c1.
* `ReadOnlyAssociation` is no longer used since 0da426b.
|
|\ \ \
| |/ /
|/| | |
Remove redundant return statements
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`join_scopes` in `PolymorphicReflection` is passed aliased `table`, so
it should be respected for `source_type_scope`.
Closes #13969.
Fixes #13920.
Fixes #15190.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
Replace the primary key type `integer` in docs with `bigint`.
ref #26266
|
|/ /
| |
| |
| | |
Removed unnecessary semicolons
|
|\ \
| | |
| | | |
delegate scope_for on PolymorphicReflection
|
| | | |
|
|/ / |
|
| |
| |
| | |
using serializable isolation would prevent the duplicate insert as done in the example from happening
|
|\ \
| | |
| | | |
Move `extensions` to `PostgreSQL::SchemaDumper`
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
and abstract `SchemaDumper#extensions` is now an empty method.
Since #30337, every database adapter has its own `SchemaDumper`.
`extensions` are only supported by PostgreSQL database and postgresql database adapter.
|
|\ \ \
| |/ /
|/| | |
Save index order :desc to schema.rb (sqlite). Fixes #30902
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Although the sqlite adapter supports index sort orders, they
weren't being written to db/schema.rb.
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
since the minimum version of PostgreSQL currently Rails supports is 9.1,
there is no need to handle if `supports_extensions?`
Refer https://www.postgresql.org/docs/9.1/static/sql-createextension.html
"CREATE EXTENSION"
|
| |
| |
| |
| |
| |
| | |
Currently alias tracker only refer a table name, doesn't respect an
alias name. Should use `join.left.name` rather than
`join.left.table_name`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`supports_disable_referential_integrity?` used to handle
if PostgreSQL database supports
`ALTER TABLE <table name> DISABLE/ENABLE TRIGGER` statements.
Refer https://github.com/rails/rails/commit/9a947af0e79cfb8692eb7e5ae94c1b8c40756f49
These statements have been documented since 8.1.
https://www.postgresql.org/docs/8.1/static/sql-altertable.html
> DISABLE/ENABLE TRIGGER
Now Rails supports PostgreSQL 9.1 or higher only.
No need to handle `supports_disable_referential_integrity?` anymore.
Also, this method does not exist in any other adapters including AbstractAdapter.
|
| | |
|
| | |
|
| | |
|
| | |
|