| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
|
|
|
|
| |
This is only used for the internal `column_spec` and
`column_spec_for_primary_key`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
currently integer types extracts the `limit` from `sql_type`. But the
lookup key of type map is the `oid` in postgresql adapter. So in most
case `sql_type` is passed to `extract_limit` as `""` and `limit` is
extracted as `nil`.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L445
In mysql2 adapter, `limit` is registered correctly without extracting
from `sql_type`.
https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L678-L682
Postgresql adapter should also be registered correctly.
``` ruby
conn = ActiveRecord::Base.connection
conn.select_all("SELECT 1::smallint, 2::integer, 3::bigint").column_types.map do |name, type|
[name, type.limit]
end
```
Before:
``` ruby
# => [["int2", nil], ["int4", nil], ["int8", nil]]
```
After:
``` ruby
# => [["int2", 2], ["int4", 4], ["int8", 8]]
```
|
|
|
|
|
|
|
|
| |
(#29944)
Since 213796f, it was lost the ability that SQL with binds for `insert`,
`update`, and `delete` (like `select_all`). This restores the ability
because `insert`, `update`, and `delete` are public API, so it should
not be removed without deprecation.
|
|
|
|
| |
Because `to_sql` is public API. I introduced `to_sql_and_binds` internal
API to return SQL and binds.
|
|\
| |
| | |
Allow `table_name_prefix` and `table_name_suffix` have `$`
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
MySQL 5.7 and PostgreSQL 9.6 allow table identifiers have the dollar sign.
* MySQL 5.7
https://dev.mysql.com/doc/refman/5.7/en/identifiers.html
> Permitted characters in unquoted identifiers:
> ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore)
* PostgreSQL 9.6
https://www.postgresql.org/docs/9.6/static/sql-syntax-lexical.html
> SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($). Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable. The SQL standard will not define a key word that contains digits or starts or ends with an underscore, so identifiers of this form are safe against possible conflict with future extensions of the standard.
Address #30044
[Yasuo Honda & Ryuta Kamizono]
|
| |
| |
| |
| | |
[ci skip]
|
| |
| |
| |
| | |
And enable `context_dependent` of Style/BracesAroundHashParameters cop.
|
|\ \
| | |
| | |
| | |
| | | |
kamipo/through_scope_should_not_be_affected_by_scoping
Through scope should not be affected by scoping
|
| | |
| | |
| | |
| | |
| | |
| | | |
Follow up of #29834.
Fixes #30266.
|
|/ /
| |
| |
| |
| |
| | |
`write_attribute_without_type_cast` is defined as a private method in
`AttributeMethods::Write`, but `AttributeMethods::Dirty` overrode it as
a public method. It should be kept the original visibility.
|
|\ \
| | |
| | |
| | | |
Ensure sum honors distinct on has_many through
|
| | |
| | |
| | |
| | |
| | |
| | | |
When using a has_many through relation and then summing an attribute
the distinct was not being used. This will ensure that when summing
an attribute, the number is only used once when distinct has been used.
|
|\ \ \
| | | |
| | | | |
Add `binary` helper method to fixtures.
|
| | | | |
|
|\ \ \ \
| | | | |
| | | | | |
Extract `primary_key` to `AbstractReflection`
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fix `reflection.association_primary_key` for `has_many` association
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
It is incorrect to treat `options[:primary_key]` as
`association_primary_key` if `has_many` associations because the
`:primary_key` means the column on the owner record, not on the
association record. It will break `ids_reader` and `ids_writer`.
```ruby
people(:david).essay_ids
# => ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'essays.first_name' in 'field list': SELECT `essays`.first_name FROM `essays` WHERE `essays`.`writer_id` = 'David'
```
Fixes #14439.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Allow `serialize` with a custom coder on `json` and `array` columns
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
We already have a test case for `serialize` with a custom coder in
`PostgresqlHstoreTest`.
https://github.com/rails/rails/blob/v5.1.3/activerecord/test/cases/adapters/postgresql/hstore_test.rb#L316-L335
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
Check :scope input in Uniqueness validator
|
| | |_|/ / / /
| |/| | | | | |
|
|\ \ \ \ \ \ \
| |_|_|_|_|/ /
|/| | | | | | |
Completes ActiveRecord::Batches.find_each example [ci skip]
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | | |
The previous paragraph mentions that you can hand off the same processing
queue to multiple workers. This completes the following example below it.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Remove unused `source_type_info` in `RuntimeReflection`
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | | |
`source_type_info` is only used for `constraints` in
`PolymorphicReflection`.
|
|/ / / / /
| | | | |
| | | | |
| | | | | |
The primary key on the owner record is abstracted as `join_foreign_key`.
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
Since `Relation` includes `Enumerable`, it is enough to use `super`
simply.
|
|/ / /
| | |
| | |
| | | |
It can use `AbstractReflection#table_name` simply.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This comment was added at 97849de, but `AssociationProxy` and
`test_triple_equality` was removed at 1644663. Currently the `===` is
used for `test_decorated_polymorphic_where` that added at #11945.
So I updated "association proxies" to "decorated models".
And also, currently `Core::ClassMethods` appears in the doc.
http://api.rubyonrails.org/classes/ActiveRecord/Core/ClassMethods.html
But it looks like that the methods in the module is not public API.
So I also added `# :nodoc:` to the module.
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
chopraanmol1/support_for_has_many_and_has_one_for_where_relation
Fixed query building when relation is passed for has one or has many association in where
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
has many association wrong set of primary key and foreign key are selected.
Changed code to use 'join' primary key and foreign key over 'association' primary key and foreign key.
|
|\ \ \ \
| | | | |
| | | | | |
Use copy to preserve file permissions
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Return Not found Ids in ActiveRecord::NotFound
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This builds on top of 15e2da656f41af0124f7577858536f3b65462ad5.
now it also returns exact Ids which were not found which will be debugging simple.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
More robust PostgreSQL database duplication check
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | | |
Fixes #29045.
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
refs: https://github.com/rails/rails/pull/30161
```
$ echo "+@size+" | rdoc --pipe
<p>+@size+</p>
$ echo "<tt>@size</tt>" | rdoc --pipe
<p><code>@size</code></p>
```
[ci skip]
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Otherwise `ConnectionPool#reap` may run before `@connections` has
initialized.
https://travis-ci.org/rails/rails/jobs/263037427#L888-L890
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Add missed `require`
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | | |
`ActiveRecord::ConnectionAdapters::QueryCache::ConnectionPoolConfiguration`
depends on `Concurrent::Map`.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
yukideluxe/add-missing-bit-reload-associations-docs
add missing collection.reload documentation [ci skip]
|
| | | | | | | |
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This module has behavior that is not present in `ActiveModel::Dirty`,
which is intended to be public API.
|