- 22 2月, 2019 2 次提交
-
-
由 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.
-
- 21 2月, 2019 6 次提交
-
-
由 Ryuta Kamizono 提交于
The argument of `_update_record` and `_create_record` is `attribute_names`, that is reserved for overriding by partial writes attribute names. https://github.com/rails/rails/blob/67e20d1d4854d834e9e43e56486d37cd98983f0d/activerecord/lib/active_record/persistence.rb#L719 https://github.com/rails/rails/blob/67e20d1d4854d834e9e43e56486d37cd98983f0d/activerecord/lib/active_record/persistence.rb#L737 https://github.com/rails/rails/blob/67e20d1d4854d834e9e43e56486d37cd98983f0d/activerecord/lib/active_record/attribute_methods/dirty.rb#L171 https://github.com/rails/rails/blob/67e20d1d4854d834e9e43e56486d37cd98983f0d/activerecord/lib/active_record/attribute_methods/dirty.rb#L177 The reason that no failing with extra args is that `Timestamp` module which is most outside module of the `_update_record` discards the extra args. https://github.com/rails/rails/blob/67e20d1d4854d834e9e43e56486d37cd98983f0d/activerecord/lib/active_record/timestamp.rb#L104 But that looks odd dependency. It should not be passed extra args, should only be passed attribute names.
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
In MySQL, the default collation is case insensitive. Since the uniqueness validator enforces case sensitive comparison by default, it frequently causes mismatched collation issues (performance, weird behavior, etc) to MySQL users. https://grosser.it/2009/12/11/validates_uniqness_of-mysql-slow/ https://github.com/rails/rails/issues/1399 https://github.com/rails/rails/pull/13465 https://github.com/gitlabhq/gitlabhq/commit/c1dddf8c7d947691729f6d64a8ea768b5c915855 https://github.com/huginn/huginn/pull/1330#discussion_r55152573 This extracts `default_uniqueness_comparison` to ease to handle the mismatched collation issues on the connection.
-
由 soartec-lab 提交于
Revert "Fix lint `ShadowingOuterLocalVariable`" This reverts commit 38bd45a48992b500478a82d56d31468a322937a8. Change of variable name Fix lint `ShadowingOuterLocalVariable`
-
由 Ryuta Kamizono 提交于
This covers what #34626 fixes.
-
由 Carl Thuringer 提交于
Using the subscript method `#[]` on a string has several overloads and rather complex implementation. One of the overloads is the capability to accept a regular expression and then run a match, then return the receiver (if it matched) or one of the groups from the MatchData. The function of the `UUID#cast` method is to cast a UUID to a type and format acceptable by postgres. Naturally UUIDs are supposed to be string and of a certain format, but it had been determined that it was not ideal for the framework to send just any old string to Postgres and allow the engine to complain when "foobar" or "" was sent, being obviously of the wrong format for a valid UUID. Therefore this code was written to facilitate the checking, and if it were not of the correct format, a `nil` would be returned as is conventional in Rails. Now, the subscript method will allocate one or more strings on a match and return one of them, based on the index parameter. However, there is no need for a new string, as a UUID of the correct format is already such, and so long as the format was verified then the string supplied is adequate for consumption by the database. The subscript method also creates a MatchData object which will never be used, and so must eventually be garbage collected. Garbage collection indeed. This innocuous method tends to be called quite a lot, for example if the primary key of a table is a uuid, then this method will be called. If the foreign key of a relation is a UUID, once again this method is called. If that foreign key is belonging to a has_many relationship with dozens of objects, then again dozens of UUIDs shall be cast to a dup of themselves, and spawn dozens of MatchData objects, and so on. So, for users that: * Use UUIDs as primary keys * Use Postgres * Operate on collections of objects This accomplishes a significant savings in total allocations, and may save many garbage collections.
-
- 20 2月, 2019 5 次提交
-
-
由 Ryuta Kamizono 提交于
This is a follow-up of #35310. Currently `Topic.find_by(id: "not-a-number")` matches to a `id = 0` record. That is considered as silently leaking information. If non numeric string is given to find by an integer column, it should not be matched to any record. Related #12793.
-
由 Ryuta Kamizono 提交于
-
由 Bogdan Gusiev 提交于
The special case happens when through association has a custom scope that is applied to the source association when loading. In this case, the soucre association would need to be reset after main association is loaded. See tests. The special case exists when a through association has
-
由 Abhay Nikam 提交于
-
由 Abhay Nikam 提交于
-
- 19 2月, 2019 2 次提交
-
-
由 Abhay Nikam 提交于
-
由 Gannon McGibbon 提交于
In AttributeMethodsTest, we make the global Topic class time zone-aware which changes instance date time attribute casting behaviour. We need to reset column info after the test because future tests don't expect Topic date time columns to be time zone-aware.
-
- 18 2月, 2019 4 次提交
-
-
由 Ryuta Kamizono 提交于
That is considered as silently leaking information. If type casting doesn't return any actual value, it should not be matched to any record. Fixes #33624. Closes #33946.
-
由 Ryuta Kamizono 提交于
Since `serialize` is passed user input args (from `where`, schema default, etc), a helper should provide `serialize` if the helper also provide `cast`. Related #32624, 34cc301f, a741208f.
-
由 Ryuta Kamizono 提交于
This is covered by `test_update_all_with_order_and_limit_updates_subset_only` and `test_update_all_with_order_and_limit_and_offset_updates_subset_only`.
-
由 Ryuta Kamizono 提交于
Before: ``` SELECT "comments".* FROM "comments" WHERE "comments"."type" IN ('VerySpecialComment') AND "comments"."post_id" = ? LIMIT ? [["post_id", 4], ["LIMIT", 1]] ``` After: ``` SELECT "comments".* FROM "comments" WHERE "comments"."type" = ? AND "comments"."post_id" = ? LIMIT ? [["type", "VerySpecialComment"], ["post_id", 4], ["LIMIT", 1]] ```
-
- 17 2月, 2019 3 次提交
-
-
由 Ryuta Kamizono 提交于
This fixes a bug that the `foreign_key` and the `foreign_type` are separated as different table conditions if a polymorphic association has a scope that joins another tables.
-
由 Finn Young 提交于
-
由 Ryuta Kamizono 提交于
This follows up 0ee96d13.
-
- 16 2月, 2019 5 次提交
-
-
由 Ryuta Kamizono 提交于
The CI failure for `test_errors_for_bigint_fks_on_integer_pk_table` is due to the poor regex that extract all ``` `(\w+)` ``` like parts from the message (`:foreign_key` should be `"old_car_id"`, but `"engines"`): https://travis-ci.org/rails/rails/jobs/494123455#L1703 I've improved the regex more strictly and have more exercised mismatched foreign key tests. Fixes #35294
-
由 Yutaka HARA 提交于
refs #35296
-
由 Ryuta Kamizono 提交于
Since #35212, foreign key feature is supported by all adapters.
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
[ci skip]
-
- 15 2月, 2019 4 次提交
-
-
由 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.
-
由 Matthew Dunbar 提交于
-
由 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.
-
由 Abhay Nikam 提交于
-
- 14 2月, 2019 2 次提交
-
-
由 eileencodes 提交于
In chat Sam Saffron asked how to use the setter now that configurations is no longer a hash and you need to do AR::Base.configurations["test"]=. Technically you can do `ActiveRecord::Base.configurations = { the hash }` but I realized the old way throws an error and is unintuitive. To aid in the transition from hashes to objects this PR makes a few changes: 1) Re-adds a deprecated hash setter `[]=` that will add a new hash to the configurations list OR replace an existing hash if that environment is already present. This won't be supported in future Rails versions but a good error is important. 2) Changed to throw deprecation warnings on the methods we decided to support for hash conversion and raise on the methods we don't support. 3) Refactored the setter/getter hash deprecation warnings messages and rewrote them. Getters message: ``` DEPRECATION WARNING: `ActiveRecord::Base.configurations` no longer returns a hash. Methods that act on the hash like `values` are deprecated and will be removed in Rails 6.1. Use the `configs_for` method to collect and iterate over the database configurations. ``` Setter message: ``` DEPRECATION WARNING: Setting `ActiveRecord::Base.configurations` with `[]=` is deprecated. Use `ActiveRecord::Base.configurations=` directly to set the configurations instead. ``` 4) Rewrote the legacy configurations test file to test all the public methods in the DatabaseConfigurations class.
-
由 Ryuta Kamizono 提交于
This reverts #32380, since this may cause that silently leaking information when people upgrade the app. We need deprecation first before making this.
-
- 13 2月, 2019 6 次提交
-
-
由 Ryuta Kamizono 提交于
This reverts commit eec3e28a, reversing changes made to 5588fb48. Reason: Marking as loaded without actual loading is too greedy optimization. See more context #35239. Closes #35239. [Edouard CHIN & Ryuta Kamizono]
-
由 Matthew Draper 提交于
-
由 Vladimir Dementyev 提交于
-
由 Ryuta Kamizono 提交于
Fixed the CI failure https://travis-ci.org/rails/rails/jobs/492291248#L1185-L1191.
-
由 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.
-
由 eileencodes 提交于
On CI we've seen a few test failures when the DatabaseSelectorTest runs before the ConnectionHandlersMultiDbTest. This is because it's creating 2 handlers but not properly tearing them down. Example failure: ``` Failure: ActiveRecord::ConnectionAdapters::ConnectionHandlersMultiDbTest#test_connects_to_with_single_configuration [/rails/activerecord/test/cases/connection_adapters/connection_handlers_multi_db_test.rb:241]: Expected: 1 Actual: 2 ```
-
- 12 2月, 2019 1 次提交
-
-
由 Ryuta Kamizono 提交于
The implicit delegation in the migration class is to be logged. It is not intended in the migration compatibility, so it should be avoided. Fixes #35224.
-