aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bump ZeitwerkXavier Noria2019-02-212-3/+3
|
* Should not pass extra args to `_update_record`Ryuta Kamizono2019-02-213-7/+13
| | | | | | | | | | | | | | | | | | | | 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.
* Merge pull request #35349 from rails/autoloaders.logger=Xavier Noria2019-02-212-0/+28
|\ | | | | Define Rails.autoloaders.logger=
| * Define Rails.autoloaders.logger=Xavier Noria2019-02-212-0/+28
| |
* | Merge pull request #35336 from ↵Ryuta Kamizono2019-02-215-9/+23
|\ \ | |/ |/| | | | | kamipo/dont_allow_non_numeric_string_matches_to_zero Don't allow `where` with non numeric string matches to 0 values
| * Don't allow `where` with non numeric string matches to 0 valuesRyuta Kamizono2019-02-205-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Address "warning: in `column': the last argument was passed as a single Hash"Ryuta Kamizono2019-02-213-11/+12
| |
* | Extract `default_uniqueness_comparison` to ease to handle mismatched ↵Ryuta Kamizono2019-02-212-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | collation issues 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.
* | Merge pull request #35345 from soartec-lab/fix_lint_activerecord_relationRyuta Kamizono2019-02-211-3/+3
|\ \ | | | | | | Fix lint `ShadowingOuterLocalVariable`
| * | Fix lint `ShadowingOuterLocalVariable`soartec-lab2019-02-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "Fix lint `ShadowingOuterLocalVariable`" This reverts commit 38bd45a48992b500478a82d56d31468a322937a8. Change of variable name Fix lint `ShadowingOuterLocalVariable`
* | | Revert "Speed up integer casting from DB"Ryuta Kamizono2019-02-212-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 52fddcc653458456f98b3683dffd781cf00b35fe. 52fddcc was to short-circuit `ensure_in_range` in `cast_value`. But that caused a regression for empty string deserialization. Since 7c6f393, `ensure_in_range` is moved into `serialize`. As 52fddcc said, the absolute gain is quite small. So I've reverted that commit to fix the regression.
* | | Merge pull request #35344 from eugeneius/active_storage_require_core_extGeorge Claghorn2019-02-201-0/+1
|\ \ \ | |/ / |/| | Add missing require to active_storage.rb
| * | Add missing require to active_storage.rbEugene Kenny2019-02-201-0/+1
| | | | | | | | | | | | | | | | | | | | | Since b21f50d8ae36d9b50b673579e17bccbe55363b34, requiring active_storage on its own has failed with the following error: activestorage/lib/active_storage.rb:55:in `<module:ActiveStorage>': undefined method `minutes' for 5:Integer (NoMethodError)
* | | Explains a detail re eager loading [ci skip]Xavier Noria2019-02-201-0/+3
|/ /
* | 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]