- 08 8月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
Actually, `first` taking non-deterministic result is considered a bug to me. But changing the behavior should not be happened in rc2. I've restored the behavior for 6.0, and then will deprecate that in 6.1. Fixes #36802.
-
- 01 8月, 2019 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 26 6月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 17 6月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
GROUP BY with virtual count attribute is invalid for almost all databases, but it is valid for PostgreSQL, and it had worked until Rails 5.2.2, so it is a regression for Rails 5.2.3 (caused by 311f0011). I can't find perfectly solution for fixing this for now, but I would not like to break existing apps, so I decided to allow referencing virtual count attribute in ORDER BY clause when GROUP BY aggrigation (it partly revert the effect of 311f0011) to fix the regression #36022. Fixes #36022.
-
- 10 6月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
Currently, almost all "Dangerous query method" warnings are false alarm. As long as almost all the warnings are false alarm, developers think "Let's ignore the warnings by using `Arel.sql()`, it actually is false alarm in practice.", so I think we should effort to reduce false alarm in order to make the warnings valuable. This allows column name with function (e.g. `length(title)`) as safe SQL string, which is very common false alarm pattern, even in the our codebase. Related 6c82b6c9, 6607ecb2, #36420. Fixes #32995.
-
- 07 6月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
There is no need to be wrapped by `Arel.sql()`.
-
- 06 6月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
Currently `posts.title` is regarded as a safe SQL string, but `"posts"."title"` (it is a result of `quote_table_name("posts.title")`) is regarded as an unsafe SQL string even though a result of `quote_table_name` should obviously be regarded as a safe SQL string, since the column name matcher doesn't respect quotation, it is a little annoying. This changes the column name matcher to allow quoted identifiers as safe SQL string, now all results of the `quote_table_name` are regarded as safe SQL string.
-
- 22 5月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
And no longer need to except SCHEMA SQLs manually since 0810c076.
-
- 04 4月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
This follows up ebc09ed9. We've still experienced a regression for `size` (`count(:all)`) with eager loading and explicit select and order when upgrading Rails to 5.1. In that case, the eager loading enforces `distinct` to subselect but still keep the custom select, it would cause the ORDER BY with DISTINCT issue. ``` % ARCONN=postgresql bundle exec ruby -w -Itest test/cases/relations_test.rb -n test_size_with_eager_loading_and_custom_select_and_order Using postgresql Run options: -n test_size_with_eager_loading_and_custom_select_and_order --seed 8356 # Running: E Error: RelationTest#test_size_with_eager_loading_and_custom_select_and_order: ActiveRecord::StatementInvalid: PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list LINE 1: ..." ON "comments"."post_id" = "posts"."id" ORDER BY comments.i... ^ ``` As another problem on `distinct` is enforced, the result of `count` becomes fewer than expected if `select` is given explicitly. e.g. ```ruby Post.select(:type).count # => 11 Post.select(:type).distinct.count # => 3 ``` As long as `distinct` is enforced, we need to care to keep the result of `count`. This fixes both the `count` with eager loading problems.
-
- 30 3月, 2019 1 次提交
-
-
由 David Heinemeier Hansson 提交于
* Add `ActiveRecord::Relation#extract_associated` for extracting associated records from a relation
-
- 07 3月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
I've found the skewness of delegation methods between `except` and `only` in a88b6f25. The `only` method is closely similar with `except` as `SpawnMethods`. https://github.com/rails/rails/blob/e056b9bfb07c4eb3bcc6672d885aadd72bec574f/activerecord/lib/active_record/relation/spawn_methods.rb#L53-L67 It is preferable both behaves the same way.
-
- 01 3月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
#35360 allows table name qualified if `from` has original table name. But that is still too strict. We have a valid use case that `from` with INDEX hint (e.g. `from("comments USE INDEX (PRIMARY)")`). So I've relaxed the table name detection in `from` to allow any extension like INDEX hint. Fixes #35359.
-
- 27 2月, 2019 1 次提交
-
- 26 2月, 2019 1 次提交
-
-
由 jvillarejo 提交于
When using `select` with `'DISTINCT( ... )'` if you use method `size` on a non loaded relation it overrides the column selected by passing `:all` so it returns different value than count. This fixes #35214
-
- 24 2月, 2019 2 次提交
-
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
-
- 23 2月, 2019 2 次提交
-
-
由 yuuji.yaginuma 提交于
It seems that the reason why the `test_select_with_subquery_in_from_uses_original_table_name` does not pass is that the return value of `sqlite3_column_name()` is wrong due to subquery flattening. This seems to have been fixed with SQLite 3.20.0(https://sqlite.org/changes.html#version_3_20_0). But CI uses the old version(maybe 3.11.0), I added `DISTINCT` to avoid optimization by subquery flattening. Ref: https://sqlite.org/optoverview.html#flattening
-
由 Ryuta Kamizono 提交于
Somehow `ENV["BUILDKITE"]` didn't work as expected.
-
- 22 2月, 2019 3 次提交
-
-
由 Ryuta Kamizono 提交于
I'm not sure why the test is failed on Travis, it passed on locally. I suspect that failure is a bug on SQLite3, so just skip the test for now, since it was not covered by before. https://travis-ci.org/rails/rails/jobs/496726410#L1198-L1208
-
由 Ryuta Kamizono 提交于
This is caused by 0ee96d13. Since #18744, `select` columns doesn't be qualified by table name if using `from`. 0ee96d13 follows that for `pluck` as well. But people depends that `pluck` columns are qualified even if using `from`. So I've fixed that to be qualified if `from` has the original table name to keep the behavior as much as before. Fixes #35359.
- 19 2月, 2019 1 次提交
-
-
由 Abhay Nikam 提交于
-
- 17 2月, 2019 2 次提交
-
-
由 Finn Young 提交于
-
由 Ryuta Kamizono 提交于
This follows up 0ee96d13.
-
- 15 2月, 2019 2 次提交
-
-
由 Ryuta Kamizono 提交于
This deprecates using class level querying methods if the receiver scope regarded as leaked, since #32380 and #35186 may cause that silently leaking information when people upgrade the app. We need deprecation first before making those.
-
由 Ryuta Kamizono 提交于
This reverts commit b67d5c6d, reversing changes made to 2e018361. Reason: #35186 may cause that silently leaking information when people upgrade the app. We need deprecation first before making this.
-
- 13 2月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
Currently custom attributes are always qualified by the table name in the generated SQL wrongly even if the table doesn't have the named column, it would cause an invalid SQL error. Custom attributes should only be qualified if the table has the same named column.
-
- 07 2月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
`relation.create` populates scope attributes to new record by `scoping`, it is necessary to assign the scope attributes to the record and to find STI subclass from the scope attributes. But the effect of `scoping` is class global, it was caused undesired behavior that pollute all class level querying methods in initialization block and callbacks (`after_initialize`, `before_validation`, `before_save`, etc), which are user provided code. To avoid the leaking scope issue, restore the original current scope before initialization block and callbacks are invoked. Fixes #9894. Fixes #17577. Closes #31526.
-
- 06 2月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
This follows up d97980a1.
-
- 08 12月, 2018 1 次提交
-
-
由 Bogdan 提交于
* `#create_or_find_by/!`: add more tests * Fix docs of `create_or_find_by` This method uses `find_by!` internally.
-
- 09 10月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
The delegation methods to named scope are defined when `method_missing` is invoked on the relation. Since #29301, the receiver in the named scope is changed to the relation like others (e.g. `default_scope`, etc) for consistency. Most named scopes would be delegated from relation by `method_missing`, since we don't allow scopes to be defined which conflict with instance methods on `Relation` (#31179). But if a named scope is defined with the same name as any method on the `superclass` (e.g. `Kernel.open`), the `method_missing` on the relation is not invoked. To address the issue, make the delegation methods to named scope is generated in the definition time. Fixes #34098.
-
- 16 9月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
`persistence_test.rb` and `relations_test.rb` have too many lines, so I'd like to extract relation around tests to dedicated files before newly test added.
-
- 11 9月, 2018 1 次提交
-
-
由 Darwin D Wu 提交于
In order to avoid double assignments of nested_attributes for `has_many` relations during record initialization, nested_attributes in `create_with` should not be passed into `klass.new` and have them populate during `initialize_internals_callback` with scope attributes. However, `create_with` keys should always have precedence over where clauses, so if there are same keys in both `create_with` and `where_values_hash`, the value in `create_with` should be the one that's used.
-
- 31 8月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
This restores an ability that `update` with ids on a relation which is described at https://github.com/rails/rails/issues/33470#issuecomment-411203013. I personally think that the `update` with two arguments on a relation is not a designed feature, since that is totally not using a relation state, and also is not documented. But removing any feature should not be suddenly happened in a stable version even if that is not documented.
-
- 31 7月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
Since 9ac7dd47, class level `update`, `destroy`, and `delete` were placed in the `Persistence` module as class methods. But `Relation#update` without passing ids which was introduced at #11898 is not a class method, and it was caused the extra scoping regression #33470. I moved the relation method back into the `Relation` to fix the regression. Fixes #33470.
-
- 19 4月, 2018 1 次提交
-
-
由 Daniel Colson 提交于
This autocorrects the violations after adding a custom cop in 3305c78dcd.
-
- 13 4月, 2018 1 次提交
-
-
由 fatkodima 提交于
-
- 15 2月, 2018 1 次提交
-
-
由 David Heinemeier Hansson 提交于
Add #create_or_find_by to lean on unique constraints
-
- 26 1月, 2018 2 次提交
-
-
由 Daniel Colson 提交于
-
由 Daniel Colson 提交于
-