| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So this bug is kinda funky. The code path is basically "if we weren't passed an
instance of the class we compose to, and we have a converter, call that".
Ignoring the hash case for a moment, everything after that was roughly intended
to be the "else" clause, meaning that we are expected to have an instance of
the class we compose to. Really, we should be blowing up in that case, as we
can give a much better error message than what they user will likely get (e.g.
`NameError: No method first for String` or something). Still, Ruby is duck
typed, so if the object you're assigning responds to the same methods as the
type you compose to, knock yourself out.
The hash case was added in 36e9be8 to remove a bunch of special cased code from
multiparameter assignment. I wrongly assumed that the only time we'd get a hash
there is in that case. Multiparameter assignment will construct a very specific
hash though, where the keys are integers, and we will have a set of keys
covering `1..part.size` exactly. I'm pretty sure this could actually be passed
around as an array, but that's a different story. Really I should convert this
to something like `class MultiParameterAssignment < Hash; end`, which I might
do soon. However for a change that I'm willing to backport to 4-2-stable, this
is what I want to go with for the time being.
Fixes #25978
|
|
|
| |
[Rafael Mendonça França + Takeshi AKIMA]
|
| |
|
|\
| |
| |
| | |
Fix the calling `merge` method at first in a scope
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Changing the order of method chaining `merge` and other query
method such as `joins` should produce the same result.
```ruby
class Topic < ApplicationRecord
scope :safe_chaininig, -> { joins(:comments).merge(Comment.newest) }
scope :unsafe_chaininig, -> { merge(Comment.newest).joins(:comments) } #=> NoMethodError
end
```
|
|/
|
|
| |
and invalid params
|
|
|
|
| |
- Also minor weekly CHANGELOG cleanup.
|
|
|
|
|
|
| |
Keeps schema migration inserts as a single commit, so we still get all of the
benefits of https://github.com/rails/rails/commit/42dd2336b31a8d98776d039a2b9fd7f834156a78,
but allows for easier git diff-ing. Fixes #25504.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When `group` is used in combination with any calculation method, the
resulting hash uses the grouping expression as the key. Currently we're
incorrectly always favoring the type reported by the query, instead of
the type known by the class. This causes differing behavior depending on
whether the adaptor actually gives proper types with the query or not.
After this change, the behavior will be the same on all adaptors -- we
see if we know the type from the class, fall back to the type from the
query, and finally fall back to the identity type.
Fixes #25595
|
|
|
|
|
|
| |
- Cleanup Active Record CHANGELOG.
- Add missing CHANGELOG for https://github.com/rails/rails/pull/25688.
- Clarify that assets requests logging is suppressed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The documentation states that parameter values longer than 20 characters
will be truncated by words, but the example shows that a parameter based
on "David Heinemeier Hansson" (with id: 125) becomes "125-david" when
"David Heinemeier".length == 16 so why so short?
The answer lies in the use of the #truncate option omission: nil which
seems to have been intended to mean "nothing", but which actually causes
the default string "..." to be used. This causes #truncate to cleave
words until the "..." can be added and still remain within the requested
size of 20 characters.
The better option is omission: '' (which is probably what was originally
intended).
Furthermore, since the use of #parameterize will remove non-alphanumeric
characters, we can maximize the useful content of the output by calling
parameterize first and then giving truncate a separator: /-/ rather than
a space.
|
|
|
|
|
|
|
| |
A concurrent thread may have also detected it to be stale, and already
released (or even reassigned) it by now.
Fixes #25585
|
|
|
|
| |
preventing infinite looping in some cases.
|
|
|
|
|
|
|
|
| |
This method appears to have been partially used in connection pool
caching, but it was introduced without much reasoning or any tests. One
edge case test was added later on, but it was focused on implementation
details. This method is no longer used outside of tests, and as such is
removed.
|
|\
| |
| | |
PostgreSQL: Fix db:structure:load silent failure on SQL error
|
| |
| |
| |
| |
| |
| |
| |
| | |
The command line flag "-v ON_ERROR_STOP=1" should be used when invoking psql to make sure errors are not suppressed.
Example: psql -v ON_ERROR_STOP=1 -q -f awesome-file.sql my-app-db
Fixes #23818.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This behavior was broken by 36e9be85. When the value is assigned
directly, either through mass assignment or directly assigning a hash,
the hash gets passed through to this writer method directly. While this
is intended to handle certain cases, when an explicit converter has been
provided, we should continue to use that instead. The positioning of the
added guard caused the new behavior to override that case.
Fixes #25210
|
|\ \
| | |
| | | |
Introduce AR::TransactionSerializationError for transaction serialization failures or deadlocks
|
| | |
| | |
| | |
| | | |
or deadlocks
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| | |
Sorry for forgetting to include it in my original PR :grimacing:
r? @rafaelfranca
[ci skip]
|
|\ \
| |/
|/|
| | |
Fix bug in JSON deserialization when column default is an empty string
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When `ActiveRecord::Coders::JSON` serialization is used and the default of the column returns `''` it raises the following error:
```
JSON::ParserError: A JSON text must at least contain two octets!
```
If MySQL is running in non-strict mode, it returns an empty string as column default for a text column:
```ruby
def extract_default
if blob_or_text_column?
@default = null || strict ? nil : ''
end
end
```
Since `''` is invalid JSON, there shouldn't be an attempt to parse it, it should be treated like nil.
ActiveRecord::Coders::JSON should behave consistently for all possible non-user-set column default values.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Follow up to 98264a1343fad6bb6637893a37fd571916b4158c
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Example:
create_table :users do |t|
t.string :name
t.index 'lower(name) varchar_pattern_ops'
end
Fixes #19090.
Fixes #21765.
Fixes #21819.
Fixes #24359.
Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
|
|\ \
| | |
| | |
| | | |
Add prepared statements support for `Mysql2Adapter`
|
|/ / |
|
|\ \
| | |
| | |
| | |
| | |
| | | |
kamipo/dump_indexes_in_create_for_generates_sql_in_one_query
Dump indexes in `create_table` for generates SQL in one query
|
|/ /
| |
| |
| |
| | |
If the adapter supports indexes in create table, it generates SQL
in one query.
|
|\ \
| | |
| | |
| | | |
Avoid a string value truncation in uniqueness validation
|
|\ \ \
| | | |
| | | |
| | | | |
Add `ActiveRecord::ValueTooLong` exception class
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
kamipo/foreign_key_respects_table_name_prefix_and_suffix
`foreign_key` respects `table_name_prefix` and `table_name_suffix`
|
|\ \ \ \
| | | | |
| | | | |
| | | | | |
Primary key should be `NOT NULL`
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Added notice when a database is successfully created or dropped.
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | | |
Add support for specifying comments for tables, columns, and indexes in database itself
|
|/ / / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Comments are specified in migrations, stored in database itself (in its schema),
and dumped into db/schema.rb file.
This allows to generate good documentation and explain columns and tables' purpose
to everyone from new developers to database administrators.
For PostgreSQL and MySQL only. SQLite does not support comments at the moment.
See docs for PostgreSQL: http://www.postgresql.org/docs/current/static/sql-comment.html
See docs for MySQL: http://dev.mysql.com/doc/refman/5.7/en/create-table.html
|
|/ / / / /
| | | | |
| | | | |
| | | | | |
[ci skip]
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Previously we were assuming that the only valid types for encoding were
arrays and hashes. However, any JSON primitive is an accepted value by
both PG and MySQL.
This does involve a minor breaking change in the handling of `default`
in the schema dumper. This is easily worked around, as passing a
hash/array literal would have worked fine in previous versions of Rails.
However, because of this, I will not be backporting this to 4.2 or
earlier.
Fixes #24234
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
We support microsecond datetime precision for MySQL 5.6.4+. MariaDB has
supported it since 5.3.0, but even 10.x versions return a compatible
version string like `5.5.5-10.1.8-MariaDB-log` which we parse as 5.5.5,
before MySQL supported microsecond precision.
Specialize our version check to account for MariaDB to fix.
|
| | | | |
| | | | |
| | | | |
| | | | | |
The option backed to `start` in da26934313a31ae530b7537aba8a7662152f4dfe.
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Add changelog for #24305
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Forgot to add, sigh.
Closes #24273
|
|/ / / / / |
|