- 21 2月, 2019 1 次提交
-
-
由 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 2 次提交
-
-
由 Aaron Patterson 提交于
Pass the template format to the digestor
-
由 Gannon McGibbon 提交于
Reset column info after making Topic tz-aware
-
- 19 2月, 2019 12 次提交
-
-
由 Ryuta Kamizono 提交于
Introduce delete_by and destroy_by methods to ActiveRecord::Relation
-
由 Ryuta Kamizono 提交于
This reverts commit 6b69ae51, reversing changes made to 84bd9ada. Reason: We already use "happen" a lots for callbacks and validations. https://github.com/rails/rails/pull/35324#issuecomment-465096483 [ci skip]
-
由 Abhay Nikam 提交于
-
由 Vipul A M 提交于
Update active_record_callbacks.md [ci skip]
-
由 Sharang Dashputre 提交于
Change 'happen' to a more technical term
-
由 Ryuta Kamizono 提交于
Don't allow `where` with invalid value matches to nil values
-
由 Shodai Suzuki 提交于
-
由 Shodai Suzuki 提交于
-
由 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.
-
由 Ryuta Kamizono 提交于
Actionpack typo fix [ci skip]
-
由 alkesh26 提交于
-
由 George Claghorn 提交于
When reloading is disabled, after_initialize hooks run after to_prepare hooks have already run for the last time. Since to_prepare hooks always run after application initializers, we don't need need to use an after_initialize hook.
-
- 18 2月, 2019 8 次提交
-
-
由 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 提交于
Return correct date in ActiveModel for time to date conversions
-
由 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`.
-
由 Aaron Patterson 提交于
-
由 Ryuta Kamizono 提交于
`value_from_multiparameter_assignment` defined by `AcceptsMultiparameterTime` helper requires `default_timezone` method which is defined at `TimeValue` helper. Since `Date` type doesn't include `TimeValue`, I've extracted `Timezone` helper to be shared by `Date`, `DateTime`, and `Time` types.
-
由 Xavier Noria 提交于
-
由 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 9 次提交
-
-
由 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.
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
Auto correct rubocop offenses
-
由 Yoshiyuki Hirano 提交于
Offenses: railties/lib/rails/autoloaders.rb:1:1: C: [Corrected] Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true. module Rails ^ actionmailer/test/base_test.rb:917:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body beginning. actionmailer/test/base_test.rb:917:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected. actionmailer/test/base_test.rb:917:5: C: [Corrected] Style/RedundantBegin: Redundant begin block detected. begin ^^^^^ actionmailer/test/base_test.rb:918:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not 4) spaces for indentation. events = [] ^^^^ actionmailer/test/base_test.rb:930:1: C: [Corrected] Layout/EmptyLinesAroundBlockBody: Extra empty line detected at block body end. actionmailer/test/base_test.rb:930:1: C: [Corrected] Layout/TrailingWhitespace: Trailing whitespace detected.
-
由 Ryuta Kamizono 提交于
Raise ActiveRecord::IrreversibleOrderError if nulls first/last is not a single ordering argument.
-
由 Finn Young 提交于
-
由 Aaron Patterson 提交于
-
由 Ryuta Kamizono 提交于
This follows up 0ee96d13.
-
由 Ryuta Kamizono 提交于
Fix the regex that extract mismatched foreign key information
-
- 16 2月, 2019 8 次提交
-
-
由 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
-
由 Ryuta Kamizono 提交于
Fix possible memory leak of ConnectionHandler
-
由 Yutaka HARA 提交于
refs #35296
-
由 Aaron Patterson 提交于
Show deprecated message instead of raise exception in `compiled_method_container` method
-
由 Ryuta Kamizono 提交于
Since #35212, foreign key feature is supported by all adapters.
-
由 Ryuta Kamizono 提交于
-
由 Ryuta Kamizono 提交于
[ci skip]
-
由 Ryuta Kamizono 提交于
Properly handle cached queries with too many bind parameters
-