aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | Use fetch for better error handlingMarc-Andre Lafortune2018-06-091-2/+2
| | | | | |
| * | | | | Use same weekday correspondance as Date#wday.Marc-Andre Lafortune2018-06-091-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DeepCover revealed that most of these `wday != 0 ? wday - 1 : 6` were not entirely covered, i.e. the case of `wday == 0` was not tested: https://deep-cover.github.io/rails-cover/activesupport/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb.html#L351 There's actually no valid reason to consider Sunday a special case, so this commit simply reajusts the values used for calculations.
* | | | | | Merge pull request #33092 from utilum/warnings_in_contribute_guideRafael França2018-06-111-6/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove ineffective no-warnings flags from Contribute guide
| * | | | | | Remove ineffective no-warnings flags from Contribute guideutilum2018-06-081-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is not working. [ci skip]
* | | | | | | Merge pull request #32997 from utilum/dev_dep_guide_update_ast_requirementsRafael França2018-06-115-10/+39
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Dev-Dep guide: mention AST third party requirements
| * | | | | | | Update ffmpeg -> FFmpeg, mutools|mupdf -> muPDFutilum2018-06-084-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
| * | | | | | | Dev-Dep guide: mention AST third party requirementsutilum2018-06-082-5/+33
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid the likes of: ``` Error: ActiveStorage::RepresentationTest#test_representing_an_MP4_video: Errno::ENOENT: No such file or directory - ffmpeg test/models/representation_test.rb:27:in `block in <class:RepresentationTest>' ``` Also note additiona macOS requirements in ActiveStorage guide. [ci skip]
* | | | / / / Don't use `target=`Rafael Mendonça França2018-06-112-2/+2
| |_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | It mark the association as loaded and this can cause the object to be in an stale state.
* | | | | | Merge pull request #33114 from utilum/redundant_accessorsRafael França2018-06-111-2/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove redundant accessors in AC test stub
| * | | | | | Remove redundant accessorsutilum2018-06-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | introduced in a0ea528b61.
* | | | | | | Use `-=` to change the update the collection on the associationRafael Mendonça França2018-06-112-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also mark the association as loaded given we changed it in memory and avoid the next access to the reader to make a query to the databse.
* | | | | | | Merge pull request #29939 from arthurchui/activerecord-delete-associations-loopRafael Mendonça França2018-06-111-1/+2
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | Use hash lookup for deleting existing associations from `target`
| * | | | | | Use hash lookup for deleting existing associations from `target`Arthur Chui2017-07-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Array#delete` searches for all occurrences in the `target` array. When performing `dependent: :destroy` in active_record/associations/collection_association, the loop becomes O(N^2). It is particularly slow when destroying large amount of associations (e.g. 10K records). Either `Hash` or `Set` can optimize the loop to O(N). `Hash` is slightly faster in this simple usage. ```ruby class Dummy; end num = 10_000 test1a = num.times.map { Dummy.new }; nil test1b = test1a.dup test2a = num.times.map { Dummy.new }; nil test2b = test2a.dup Benchmark.ips do |x| x.config(stats: :bootstrap, confidence: 95) x.report("hash") do hash = test1a.group_by { |r| r } test1b.select! { |r| !hash[r] } end x.report("array") do test2a.each { |r| test2b.delete(r) } end x.compare! end ``` ``` Calculating ------------------------------------- hash 11.000 i/100ms array 1.000 i/100ms ------------------------------------------------- hash 114.586 (±16.6%) i/s - 561.000 array 1.710k (±10.3%) i/s - 8.377k Comparison: array: 1710.4 i/s hash: 114.6 i/s - 14.93x slower ```
* | | | | | | Merge pull request #32956 from Shopify/i18n_activemodel_errors_full_messageRafael França2018-06-115-2/+135
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | Allow to override the full_message error format
| * | | | | | Add global config for config.active_model.i18n_full_messageMartin Larochelle2018-06-055-1/+59
| | | | | | |
| * | | | | | Allow to override the full_message error formatMartin Larochelle2018-05-222-2/+77
| | | | | | |
* | | | | | | Merge pull request #33093 from rails/use-rack-to-dump-queryAaron Patterson2018-06-112-3/+11
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Use Rack to generate query information under test
| * | | | | | | Use Rack to generate query information under testAaron Patterson2018-06-082-3/+11
| | |_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `to_query` sorts parameters before encoding them. This causes a round tripping issue as noted here: https://github.com/rails/rails/issues/23997#issuecomment-328297933 https://github.com/rails/rails/issues/10529#issuecomment-328298109 https://github.com/rails/rails/pull/30558 Unfortunately, that method is being used to generate cache keys, so its results need to be stable: https://github.com/rails/rails/commit/10dec0e65e1f4d87f411b4361045eba86b121be9 However, the test harness is only using `to_query` to encode parameters before sending them to the controller so the "cache key" usecase doesn't apply here. This commit adds a test that demonstrates the round trip problems and changes the serialization strategy to use Rack for encoding the parameters rather than `to_query`.
* | | | | | | Fix alias confliction when joining same table on has many through with ↵Ryuta Kamizono2018-06-112-1/+5
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | left_joins This regression was caused by #30995 due to `Hash#fetch` won't invoke default proc. Just revert the change since #30995 is completely fixed by e9c1653. Fixes #33048.
* | | | | | :scissors:Ryuta Kamizono2018-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | Update `config.active_storage.variable_content_types` default value in ↵yuuji.yaginuma2018-06-101-1/+1
| |_|_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | guides [ci skip] Follow up of 3915a47.
* | | | | Merge pull request #33078 from bogdanvlviv/add-remove-requireRyuta Kamizono2018-06-095-13/+5
|\ \ \ \ \ | | | | | | | | | | | | Add/Remove `require`
| * | | | | Add missing `require`bogdanvlviv2018-06-072-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `activesupport/test/logger_test.rb` requires `tmpdir`. `activesupport/test/multibyte_test_helpers.rb` requires `filutils`, `open-uri`, and `tmpdir`.
| * | | | | Remove unused `require`bogdanvlviv2018-06-073-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `activesupport/multibyte_normalization_conformance_test.rb` `fileutils`, `tmpdir`, and `open-uri` are unused since c245ca30f248367e07d5d831195b12c93a1e3137, c245ca30f248367e07d5d831195b12c93a1e3137, and 7d7c2d13ba896dd8b58fe91d2fe0c4fc588069ca in accordance. - `activesupport/test/multibyte_conformance_test.rb` `tmpdir`, and `open-uri` are unused since c245ca30f248367e07d5d831195b12c93a1e3137, and 7d7c2d13ba896dd8b58fe91d2fe0c4fc588069ca in accordance. Remove using of `fileutils` since c245ca30f248367e07d5d831195b12c93a1e3137. - `activesupport/test/multibyte_grapheme_break_conformance_test.rb` `fileutils`, `tmpdir`, and `open-uri` are unused since c245ca30f248367e07d5d831195b12c93a1e3137, c245ca30f248367e07d5d831195b12c93a1e3137, and 7d7c2d13ba896dd8b58fe91d2fe0c4fc588069ca in accordance.
* | | | | | Avoid Node.js v10.4.0 for nowyuuji.yaginuma2018-06-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If use Node.js v10.4.0, ujs's build will result in an error, so temporarily fix the version to v10.3.0. Ref: https://travis-ci.org/rails/rails/jobs/389960856
* | | | | | Merge pull request #33087 from bogdanvlviv/document-CompareWithRangeRafael França2018-06-081-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add `ActiveSupport::CompareWithRange` to API docs
| * | | | | | Add `ActiveSupport::CompareWithRange` to API docsbogdanvlviv2018-06-071-1/+1
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since it is documented in the guides http://edgeguides.rubyonrails.org/active_support_core_extensions.html#include-questionmark-and-cover-questionmark we can add it to API docs http://edgeapi.rubyonrails.org too. [ci skip]
* | | | | | Merge pull request #33102 from bogdanvlviv/refactor-actioncable-testsRafael França2018-06-0818-45/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | Refactor actioncable's tests
| * | | | | | Include `ActiveSupport::Testing::MethodCallAssertions` to ↵bogdanvlviv2018-06-0813-36/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `ActionCable::TestCase` Remove all `include ActiveSupport::Testing::MethodCallAssertions` in actioncable's tests since we can do it only in `ActionCable::TestCase` in order to prevent code duplication. We use the same approach for other modules of Rails.
| * | | | | | Inherit all actioncable's test classes from `ActionCable::TestCase`bogdanvlviv2018-06-089-9/+9
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | We have defined `ActionCable::TestCase` in `actioncable/test/test_helper.rb` that we can use in order to prevent code duplication and build common interface for actioncable's test.
* | | | | | Merge pull request #33103 from bogdanvlviv/fix-using-of-method_call_assertionsRafael França2018-06-083-5/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove extra `include ActiveSupport::Testing::MethodCallAssertions`
| * | | | | | Include `ActiveSupport::Testing::MethodCallAssertions` in ↵bogdanvlviv2018-06-092-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `railties/test/isolation/abstract_unit.rb` Related to #33102
| * | | | | | Remove extra `include ActiveSupport::Testing::MethodCallAssertions`bogdanvlviv2018-06-081-3/+0
| |/ / / / / | | | | | | | | | | | | | | | | | | It includes via `require "abstract_unit"`.
* | | | | | Merge pull request #27577 from maclover7/jm-fix-27547Rafael Mendonça França2018-06-082-8/+47
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | Action Cable owns database connection, not Active Record
| * | | | | Action Cable owns database connection, not Active RecordJon Moss2017-03-252-8/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the database connection used in Action Cable's PostgreSQL adapter was "owned" by `ActiveRecord::Base.connection_pool`. This meant that if, for example, `#clear_reloadable_connections!` was called on the pool, Active Record would "steal" the database connection from Action Cable, and would cause all sorts of issues. This became evident during file reloads; despite Action Cable trying its hardest to return its borrowed database connection to Active Record via `@pubsub.shutdown`, Active Record calls `#clear_reloadable_connections!` on the connection pool, and due to the order of callbacks, Active Record's callback was being executed first. This meant that if you tried to rerender a view after a file was reloaded, you would have to wait through Active Record's timeout and such. Now, Action Cable takes direct ownership of the database connection it uses. It removes the connection from the pool to avoid the situation described above. Action Cable also makes sure to call `#disconnect!` on the connection when appropriate, to match the previous behavior of Active Record. [ Jon Moss & Matthew Draper]
* | | | | | Merge pull request #33089 from bogdanvlviv/refactor-attached_test.rbGeorge Claghorn2018-06-071-19/+21
|\ \ \ \ \ \ | | | | | | | | | | | | | | Refactor activestorage/test/models/attached_test.rb
| * | | | | | Refactor activestorage/test/models/attached_test.rbbogdanvlviv2018-06-071-19/+21
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't include `ActiveJob::TestHelper` since there is no test that uses it. Ensure removing of overridden User's methods. Related to https://github.com/rails/rails/pull/33085#issuecomment-395548563 Module#remove_method is private in Ruby 2.4. Related to fd0bd1bf682622f064ac437ceee4e1b2a6b6d3b9
* | | | | | Revert "Merge pull request #33085 from bogdanvlviv/refactor-attached_test.rb"George Claghorn2018-06-071-21/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 07c035e72dd2267c2a45a7ddd2450687d6329b5b, reversing changes made to 7b33903d7f30027fe99e4632c5517f0c469b3424.
* | | | | | Merge pull request #33085 from bogdanvlviv/refactor-attached_test.rbGeorge Claghorn2018-06-071-19/+21
|\ \ \ \ \ \ | | | | | | | | | | | | | | Refactor activestorage/test/models/attached_test.rb
| * | | | | | Refactor activestorage/test/models/attached_test.rbbogdanvlviv2018-06-071-19/+21
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't include `ActiveJob::TestHelper` since there is no test that uses it. Ensure removing of overridden User's methods. Don't use `send` to execute `remove_method` since it is public. Related to fd0bd1bf682622f064ac437ceee4e1b2a6b6d3b9
* | | | | | Merge pull request #33086 from bogdanvlviv/fix-index_with-in-guideGeorge Claghorn2018-06-071-2/+2
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Fix example of `index_with`
| * | | | | Fix example of `index_with`bogdanvlviv2018-06-071-2/+2
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Clarify executor of `public_send`. - Do not wrap `Interval.all_day` into [] since an array is expected as a returned value. Related to #32523. [ci skip]
* | | | | Escape newlines in the GCS private key for valid YAML [ci skip]George Claghorn2018-06-061-1/+1
| | | | |
* | | | | Fix GROUP BY queries to apply LIMIT/OFFSET after aggregationsRyuta Kamizono2018-06-072-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If `eager_loading` is true, `apply_join_dependency` force applies LIMIT/OFFSET before JOINs by `limited_ids_for` to keep parent records count. But for aggregation queries, LIMIT/OFFSET should be applied after aggregations the same as SQL semantics. And also, we could not replace SELECT list by `limited_ids_for` when a query has a GROUP BY clause. It had never been worked since it will causes generating invalid SQL for MySQL, PostgreSQL, and probably most backends. ``` % ARCONN=postgresql be ruby -w -Itest test/cases/calculations_test.rb -n test_group_by_with_limit Using postgresql Run options: -n test_group_by_with_limit --seed 20925 # Running: E Error: CalculationsTest#test_group_by_with_limit: ActiveRecord::StatementInvalid: PG::GroupingError: ERROR: column "posts.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT DISTINCT "posts"."id", "posts"."type" AS alias_0 FRO... ^ : SELECT DISTINCT "posts"."id", "posts"."type" AS alias_0 FROM "posts" LEFT OUTER JOIN "comments" ON "comments"."post_id" = "posts"."id" GROUP BY "posts"."type" ORDER BY "posts"."type" ASC LIMIT $1 ``` Fixes #8103. Closes #27249.
* | | | | Fix `collection.create` to could be rolled back by `after_save`Ryuta Kamizono2018-06-073-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In `_create_record`, explicit `transaction` block requires rollback handling manually when `insert_record` is failed. We need to handle it in `_create_record`, not in `insert_record`, since our test cases expect a record added to target and returned even if `insert_record` is failed, Closes #31488.
* | | | | Reuse existing model for testing duplicated children recordsRyuta Kamizono2018-06-073-19/+13
| | | | | | | | | | | | | | | | | | | | Follow up of #32952.
* | | | | Merge pull request #33067 from kamipo/fix_force_equalityRafael França2018-06-063-1/+11
|\ \ \ \ \ | | | | | | | | | | | | Fix force equality checking not to break the serialized attribute with Array
| * | | | | Fix force equality checking not to break the serialized attribute with ArrayRyuta Kamizono2018-06-063-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | Context: https://github.com/rails/rails/commit/43ef00e5d7a55ad79bc840276d33cb70f1f5dde5#commitcomment-29256140
* | | | | | Merge pull request #33066 from chalofa/alias_child_joinsRyuta Kamizono2018-06-062-2/+27
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Child joins should be aliased when merging relations
| * | | | | Child joins should be aliased when merging relationsChalo Fernandez2018-06-062-2/+27
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails 5.2 does not alias child joins, causing an error about duplicated table/fields: Example: Using some code like: `Post.joins(:author, :categorizations).merge(Author.select(:id)).merge(Categorization.joins(:author))` *Before this fix:* ` SELECT ... FROM "posts" INNER JOIN "authors" ON ... INNER JOIN "authors" ON ... ` *After this fix:* ` SELECT ... FROM "posts" INNER JOIN "authors" ON ... INNER JOIN "authors" "authors_categorizations" ON ... ` Before 5.2, Rails aliased the joins, but wrongfully transformed them into a LEFT OUTER JOIN. This fix will keep them as INNER JOINS, but make sure child joins are aliased, to avoid errors.