aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge pull request #35342 from alkesh26/actionview-typo-fixesVipul A M2019-02-212-2/+2
|\ \ \ | | | | | | | | [ci skip] actionview typo fixes.
| * | | [ci skip] actionview typo fixes.alkesh262019-02-212-2/+2
|/ / /
* | | More exercise test cases for order by table name qualified column nameRyuta Kamizono2019-02-211-8/+8
| | | | | | | | | | | | This covers what #34626 fixes.
* | | Merge pull request #35263 from hatch-carl/reduce-postgres-uuid-allocationsRyuta Kamizono2019-02-212-4/+19
|\ \ \ | | | | | | | | Reduce unused allocations when casting UUIDs for Postgres
| * | | Reduce unused allocations when casting UUIDs for PostgresCarl Thuringer2019-02-202-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | Merge pull request #35340 from ↵Rafael França2019-02-202-0/+6
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | cpruitt/fix-actionview-notimplemented-with-path-set Deprecate ActionView::PathSet as argument to ActionView::Base.new
| * | | | Deprecate ActionView::PathSet as argument to ActionView::Base.newCliff Pruitt2019-02-202-0/+6
|/ / / / | | | | | | | | | | | | Currently, `ActionView::Base.new` will raise a `NotImplementedError` when given an instance of `ActionView::PathSet` on initialization. This commit prevents the raised error in favor of a deprecation warning.
* | | | Merge pull request #35338 from abhaynikam/35327-follow-to-update-documentationVipul A M2019-02-201-2/+2
|\ \ \ \ | | | | | | | | | | [ci skip] Updated the documentation for bulk delete in activerecord
| * | | | [ci skip] Updated the documentation for bulk delete in activerecordAbhay Nikam2019-02-201-2/+2
|/ / / /
* | | | Merge pull request #35327 from abhaynikam/use-delete-by-and-destroy-by-methodRyuta Kamizono2019-02-205-5/+5
|\ \ \ \ | |_|/ / |/| | | Replaced usage of where.delete/destroy_all with delete/destroy_by
| * | | Replaced usage of where.delete/destroy_all with delete/destroy_byAbhay Nikam2019-02-205-5/+5
| | | |
* | | | Merge pull request #35247 from bogdan/fix-source-reflection-reset-codeRyuta Kamizono2019-02-205-24/+22
|\ \ \ \ | | | | | | | | | | Fix reset of the source association when through association is loaded
| * | | | Fix reset of the source association when through association is loadedBogdan Gusiev2019-02-205-24/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | PostgreSQL: Support endless range values for range typesRyuta Kamizono2019-02-203-2/+18
| | | | |
* | | | | Merge pull request #35325 from ↵Ryuta Kamizono2019-02-201-1/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | abhaynikam/add-query-method-delegation-test-for-destory-by-and-delete-by Added delegation tests for delete_by and destroy_by methods
| * | | | | Add delegation tests for delete_by and destroy_by methodsAbhay Nikam2019-02-201-1/+1
|/ / / / /
* | | | | Merge pull request #35331 from rails/depreate-rendered-formatAaron Patterson2019-02-193-7/+21
|\ \ \ \ \ | | | | | | | | | | | | Deprecate LookupContext#rendered_format
| * | | | | Deprecate LookupContext#rendered_formatAaron Patterson2019-02-193-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We no longer depend on `rendered_format` side effects, so we can remove this method now. 🎉
* | | | | | Merge pull request #35332 from rails/zeitwerk-unhookXavier Noria2019-02-196-2/+40
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Let Zeitwerk integration unhook AS::Dependencies
| * | | | | let Zeitwerk integration unhook AS::DependenciesXavier Noria2019-02-196-2/+40
| | |_|/ / | |/| | |
* | | | | Merge pull request #35265 from rails/return-rendered-templatesAaron Patterson2019-02-1911-39/+113
|\ \ \ \ \ | |/ / / / |/| | | | Return rendered template objects from renderers
| * | | | Fix up styleAaron Patterson2019-02-194-8/+8
| | | | |
| * | | | Return rendered template information instead of just stringsAaron Patterson2019-02-197-31/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces "rendered template" and "rendered collection" objects. The template renderers can now return a more complex object than just strings. This allows the framework to get more information about the templates that were rendered. In this commit we use the rendered template object to set the "rendered_format" on the lookup context in the controller rather than all the way in the template renderer. That means we don't need to check the "rendered_format" every time we render a template, we just do it once after all templates have been rendered.
| * | | | Move inline rendering content-type test to a controller testAaron Patterson2019-02-192-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is to remove direct access to the "rendered_format" attribute on the lookup context. "rendered_format" is an implementation detail that we shouldn't test directly.
| * | | | Add a test that writes to the collection cacheAaron Patterson2019-02-191-1/+8
| | | | |
| * | | | rename push / pop functionAaron Patterson2019-02-192-2/+2
|/ / / /
* | | | Merge pull request #35293 from rails/remove-rendered-format-from-cacheAaron Patterson2019-02-1912-50/+53
|\ \ \ \ | | | | | | | | | | Pass the template format to the digestor
| * | | | remove another call to rendered_format=Aaron Patterson2019-02-171-2/+0
| | | | |
| * | | | pass format to the digestorAaron Patterson2019-02-161-5/+5
| | | | |
| * | | | Pass the template format to the digestorAaron Patterson2019-02-1511-43/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit passes the template format to the digestor in order to come up with a key. Before this commit, the digestor would depend on the side effect of the template renderer setting the rendered_format on the lookup context. I would like to remove that mutation, so I've changed this to pass the template format in to the digestor. I've introduced a new instance variable that will be alive during a template render. When the template is being rendered, it pushes the current template on to a stack, setting `@current_template` to the template currently being rendered. When the cache helper asks the digestor for a key, it uses the format of the template currently on the stack.
* | | | | Merge pull request #35271 from gmcgibbon/fix_time_attribute_test_failuresGannon McGibbon2019-02-191-0/+4
|\ \ \ \ \ | |_|_|/ / |/| | | | Reset column info after making Topic tz-aware
| * | | | Reset column info after making Topic tz-awareGannon McGibbon2019-02-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge pull request #35316 from abhaynikam/35304-add-delete_by_and_destroy_byRyuta Kamizono2019-02-194-1/+71
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Introduce delete_by and destroy_by methods to ActiveRecord::Relation
| * | | | | Introduce delete_by and destroy_by methods to ActiveRecord::RelationAbhay Nikam2019-02-194-1/+71
| | | | | |
* | | | | | Revert "Merge pull request #35324 from sharang-d/patch-2"Ryuta Kamizono2019-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6b69ae5149f03c2f81a795c085bce56ec18535ae, reversing changes made to 84bd9adafde36d0192849649b86ffcd4e59e5e11. Reason: We already use "happen" a lots for callbacks and validations. https://github.com/rails/rails/pull/35324#issuecomment-465096483 [ci skip]
* | | | | | Merge pull request #35324 from sharang-d/patch-2Vipul A M2019-02-191-1/+1
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Update active_record_callbacks.md [ci skip]
| * | | | | Update active_record_callbacks.md [ci skip]Sharang Dashputre2019-02-191-1/+1
|/ / / / / | | | | | | | | | | | | | | | Change 'happen' to a more technical term
* | | | | Merge pull request #35310 from kamipo/dont_allow_invalid_value_matches_to_nilRyuta Kamizono2019-02-195-8/+22
|\ \ \ \ \ | | | | | | | | | | | | Don't allow `where` with invalid value matches to nil values
| * | | | | Don't allow `where` with invalid value matches to nil valuesRyuta Kamizono2019-02-185-8/+22
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Delete documentation inconsistency 'finally' for AR callbacks [ci skip] ↵Shodai Suzuki2019-02-192-2/+2
| | | | | | | | | | | | | | | | | | | | (#35303)
* | | | | Add combining callback conditions [skip ci] (#35313)Shodai Suzuki2019-02-191-0/+14
| |/ / / |/| | |
* | | | Merge pull request #35318 from alkesh26/actionpack-typo-fixRyuta Kamizono2019-02-191-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Actionpack typo fix [ci skip]
| * | | | appropriate typo fixalkesh262019-02-191-1/+1
| |/ / /
* / / / Fix preparing the configured Action Mailbox ingress in productionGeorge Claghorn2019-02-181-6/+4
|/ / / | | | | | | | | | 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.
* | | Merge pull request #29651 from Sayanc93/return-correct-dateRyuta Kamizono2019-02-183-2/+30
|\ \ \ | | | | | | | | | | | | Return correct date in ActiveModel for time to date conversions
| * | | Return correct date in ActiveModel for time to date conversionsSayan Chakraborty2017-12-173-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | time.to_date conversion happens considering leap years so a conversion of "Day.new({'day(1i)'=>'1', 'day(2i)'=>'1', 'day(3i)'=>'1'})" results in saving the date as Mon, 03 Jan 0001 which might seem weird on the user level, hence falling back to parsing on string level resolves this data mismatch Fixes #28521
* | | | Extract duplicated `serialize` methods into helpersRyuta Kamizono2019-02-189-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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, 34cc301, a741208.
* | | | Remove duplicated `test_update_all_with_order_and_limit`Ryuta Kamizono2019-02-181-6/+0
| | | | | | | | | | | | | | | | | | | | 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`.
* | | | Fix type cast with values hash for Date typeRyuta Kamizono2019-02-187-13/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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.
* | | | upgrades Zeitwerk to 1.2.0Xavier Noria2019-02-172-3/+3
| | | |