aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #36384 from ↵Ryuta Kamizono2019-06-033-2/+28
|\ | | | | | | | | guigs/fix-invalid-schema-when-pk-column-has-comment Fix invalid schema dump when primary key column has a comment
| * Fix invalid schema dump when primary key column has a commentGuilherme Goettems Schneider2019-06-033-2/+28
| | | | | | | | | | | | | | | | Before this fix it would either generate an invalid schema, passing `comment` option twice to `create_table`, or it move the comment from primary key column to the table if table had no comment when the dump was generated. The situation now is that a comment on primary key will be ignored (not present on schema). Fixes #29966
* | Merge pull request #36379 from abhaynikam/36034-remove-unnecessary-require-pathYuji Yaginuma2019-06-033-3/+0
|\ \ | | | | | | Remove unnecessary require pathname from actionpack controller specs
| * | Remove unnecessary require pathname from actionpack controller specsAbhay Nikam2019-06-023-3/+0
| | |
* | | Fix `subscribed` with no pattern to subscribe all messagesRyuta Kamizono2019-06-033-11/+27
| | | | | | | | | | | | | | | | | | | | | This is a regression for #36184. And also, add new `monotonic` argument to the last of the method signature rather than the first.
* | | Refactor `create_table`'s options separationRyuta Kamizono2019-06-032-12/+11
|/ / | | | | | | | | | | | | | | `create_table` and `t.column` have the same named options (e.g. `:comment`, `:primary_key`), so it should be separated table options from column options. Related #36373.
* | Merge pull request #36375 from kamipo/fast_saveRyuta Kamizono2019-06-021-16/+26
|\ \ | | | | | | Avoid making extra 5 arrays in each `save`
| * | Avoid making extra 5 arrays in each `save`Ryuta Kamizono2019-06-011-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each `save` calls `all_timestamp_attributes_in_model` to fill timestamp columns. Allthough the `all_timestamp_attributes_in_model` returns the same value every time, the `all_timestamp_attributes_in_model` makes extra 5 arrays every time. This avoids the making extra 5 arrays by memoizing the result, it makes `save` economical and a bit faster. https://gist.github.com/kamipo/1ddad2235073f508637bf9a72d64bb83 Before (2a015f6c0be0593a624b0c800e5335319ac4c660): ``` {["~/rails/activerecord/lib/active_record/timestamp.rb", 76, :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640], ["~/rails/activerecord/lib/active_record/timestamp.rb", 64, :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640], ["~/rails/activerecord/lib/active_record/timestamp.rb", 80, :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640], ["~/rails/activerecord/lib/active_record/timestamp.rb", 68, :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640], ["~/rails/activerecord/lib/active_record/timestamp.rb", 73, :T_ARRAY]=>[1000, 0, 341, 0, 1, 13640]} Warming up -------------------------------------- User.create * 10 36.000 i/100ms Calculating ------------------------------------- User.create * 10 353.644 (± 7.4%) i/s - 1.764k in 5.021876s ``` After (this change): ``` {["~/rails/activerecord/lib/active_record/timestamp.rb", 83, :T_ARRAY]=>[1, 0, 1, 1, 1, 40], ["~/rails/activerecord/lib/active_record/timestamp.rb", 87, :T_ARRAY]=>[1, 0, 1, 1, 1, 40], ["~/rails/activerecord/lib/active_record/timestamp.rb", 64, :T_ARRAY]=>[1, 1, 1, 1, 1, 0], ["~/rails/activerecord/lib/active_record/timestamp.rb", 69, :T_ARRAY]=>[1, 1, 1, 1, 1, 0], ["~/rails/activerecord/lib/active_record/timestamp.rb", 74, :T_ARRAY]=>[1, 1, 1, 1, 1, 0]} Warming up -------------------------------------- User.create * 10 37.000 i/100ms Calculating ------------------------------------- User.create * 10 380.063 (± 7.1%) i/s - 1.924k in 5.097917s ```
* | | Merge pull request #36378 from yahonda/test_pluck_columns_with_same_nameRyuta Kamizono2019-06-021-1/+1
|\ \ \ | | | | | | | | Address occasional test_pluck_columns_with_same_name failure
| * | | Address test_pluck_columns_with_same_name failure due to nondeterministic ↵Yasuo Honda2019-06-021-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sort order ```ruby $ bundle exec rake test_postgresql ... snip ... Failure: CalculationsTest#test_pluck_columns_with_same_name [/home/yahonda/git/rails/activerecord/test/cases/calculations_test.rb:842]: --- expected +++ actual @@ -1 +1 @@ -[["The First Topic", "The Second Topic of the day"], ["The Third Topic of the day", "The Fourth Topic of the day"]] +[["The Third Topic of the day", "The Fourth Topic of the day"], ["The First Topic", "The Second Topic of the day"]] ```
* / / Simplify `ActionDispatch::Response#content_type`yuuji.yaginuma2019-06-021-2/+1
|/ /
* | Merge pull request #36034 from y-yagi/fixes_35709Yuji Yaginuma2019-06-0123-120/+171
|\ \ | | | | | | Change `ActionDispatch::Response#content_type` returning Content-Type header as it is
| * | Change `ActionDispatch::Response#content_type` returning Content-Type header ↵yuuji.yaginuma2019-06-0123-120/+171
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as it is Since #35709, `Response#conten_type` returns only MIME type correctly. It is a documented behavior that this method only returns MIME type, so this change seems appropriate. https://github.com/rails/rails/blob/39de7fac0507070e3c5f8b33fbad6fced84d97ed/actionpack/lib/action_dispatch/http/response.rb#L245-L249 But unfortunately, some users expect this method to return all Content-Type that does not contain charset. This seems to be breaking changes. We can change this behavior with the deprecate cycle. But, in that case, a method needs that include Content-Type with additional parameters. And that method name is probably the `content_type` seems to properly. So I changed the new behavior to more appropriate `media_type` method. And `Response#content_type` changed (as the method name) to return Content-Type header as it is. Fixes #35709. [Rafael Mendonça França & Yuuji Yaginuma ]
* | Merge pull request #36373 from ↵Ryuta Kamizono2019-06-013-1/+10
|\| | | | | | | | | guigs/fix-table-comment-also-being-applied-to-the-primary-key-column Fix table comment also being applied to the primary key column
| * Fix table comment also being applied to the primary key columnGuilherme Goettems Schneider2019-05-313-1/+10
|/
* Merge pull request #36369 from jhawthorn/parallel_worker_crashJohn Hawthorn2019-05-312-0/+26
|\ | | | | Fail parallel tests if workers exit early
| * Fail parallel tests if workers exit earlyJohn Hawthorn2019-05-302-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a test worker exited early, the in-flight test it was supposed to run wasn't reported as a failure. If all workers exited immediately, this would be reported as ex. Finished in 1.708349s, 39.2192 runs/s, 79.0237 assertions/s. 67 runs, 135 assertions, 0 failures, 0 errors, 2 skips This commit validates that all workers finish running tests by ensuring that the queue is empty after they exit. This works because we signal the workers to exit by pushing nil onto the queue, so that there should be a number of items left in the queue matching potentially missed tests.
* | Add a changelog entry for 165785eGeorge Claghorn2019-05-301-2/+11
|/
* Skip image analysis on ImageMagick errorGeorge Claghorn2019-05-301-0/+3
|
* Address intermittent CI failure due to non-determined sort orderRyuta Kamizono2019-05-301-6/+7
| | | | https://buildkite.com/rails/rails/builds/61384#ad441461-87d8-4bdc-a71f-61921fe2df2e/993-1004
* Merge pull request #36356 from sebroeder/patch-1Richard Schneeman2019-05-291-1/+1
|\ | | | | Remove wrong default value for `cache_versioning` in documentation of `cache_version`
| * Remove wrong default value for `cache_versioning` in documentation of ↵Sebastian Röder2019-05-291-1/+1
|/ | | | | `cache_version` `ActiveRecord::Base.cache_versioning` it `true` by default since Rails 5.2 as stated correctly in the documentation for the `ActiveRecord::Base.cache_versioning` class attribute. Remove the wrong and duplicated documentation of the default value for `cache_versioning` from `cache_version`.
* Merge pull request #36077 from st0012/update-doc-for-pluckPrem Sichanugrist2019-05-291-0/+15
|\ | | | | Add a section to introduce pluck's eager loading behavior [ci skip]
| * Add a section to introduce `pluck`'s eager loading behaviorst00122019-05-031-0/+15
| |
* | Bring `after_bundle` back to API document [ci skip]yuuji.yaginuma2019-05-291-1/+6
| | | | | | | | | | At class level `:nodoc:` all elements are prevented. Instead, use `:stopdoc:` / `:startdoc:` to make `after_bundle` appear.
* | Remove `frozen_string_literal` magic comment from template fileyuuji.yaginuma2019-05-291-2/+0
| | | | | | | | | | | | | | The other template files do not add `frozen_string_literal`, so should behave the same. Ref: #30342, #30348.
* | Address intermittent CI failure in cascaded_eager_loading_test.rbRyuta Kamizono2019-05-291-12/+12
| | | | | | | | https://buildkite.com/rails/rails/builds/61362#99165d42-172d-4ad5-bf72-b29d8cd44f3e/995-1006
* | Merge pull request #36353 from p8/fix-spelling-in-face-modelRyuta Kamizono2019-05-291-1/+1
|\ \ | | | | | | | | | | | | Fix comment for "broken" inverse_of associations [ci skip]
| * | Fix comment for "broken" inverse_of associations [ci skip]Petrik2019-05-281-1/+1
| | |
* | | Address intermittent CI failure due to unfilled schema columns cacheRyuta Kamizono2019-05-291-3/+3
| | | | | | | | | | | | https://buildkite.com/rails/rails/builds/61358#a78ee50e-30b5-48a2-858f-63eba287d919/1290-1298
* | | Merge pull request #36324 from yoones/fix-unexpected-select-tag-delete-behaviorEileen M. Uchitelle2019-05-283-1/+12
|\ \ \ | | | | | | | | Fix unexpected select_tag delete behavior when include_blank is present
| * | | Fix select_tag so that is doesn't change options when include_blank is setYounes SERRAJ2019-05-223-1/+12
| | | |
* | | | Merge pull request #36352 from kamipo/fast_pluck_datetimeRyuta Kamizono2019-05-281-3/+10
|\ \ \ \ | | | | | | | | | | Don't round off subseconds unless necessary
| * | | | Don't round off subseconds unless necessaryRyuta Kamizono2019-05-281-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, if `:datetime` type has a precision, type casting always does round off subseconds regardless of whether necessary or not, it is a bit slow. Since #34970, `t.timestamps` with `precision: 6` by default, so `pluck(:created_at)` in newly created app will always be affected by the round off. This avoids the round off if possible, it makes `pluck(:created_at)` about 25% faster. https://gist.github.com/kamipo/e029539f2632aee9f5e711fe66fc8842 Before (0a87d7c9ddb95cf7568baf889ff4091469ba9af4 with postgresql adapter): ``` Warming up -------------------------------------- users.pluck(:id) 344.000 i/100ms users.pluck(:name) 336.000 i/100ms users.pluck(:created_at) 206.000 i/100ms Calculating ------------------------------------- users.pluck(:id) 3.620k (± 8.5%) i/s - 18.232k in 5.077316s users.pluck(:name) 3.579k (± 9.4%) i/s - 17.808k in 5.020230s users.pluck(:created_at) 2.069k (± 8.0%) i/s - 10.300k in 5.019284s ``` Before (0a87d7c9ddb95cf7568baf889ff4091469ba9af4 with mysql2 adapter): ``` Warming up -------------------------------------- users.pluck(:id) 245.000 i/100ms users.pluck(:name) 240.000 i/100ms users.pluck(:created_at) 180.000 i/100ms Calculating ------------------------------------- users.pluck(:id) 2.548k (± 9.4%) i/s - 12.740k in 5.066574s users.pluck(:name) 2.513k (± 8.0%) i/s - 12.480k in 5.011260s users.pluck(:created_at) 1.771k (±11.2%) i/s - 8.820k in 5.084473s ``` After (this change with postgresql adapter): ``` Warming up -------------------------------------- users.pluck(:id) 348.000 i/100ms users.pluck(:name) 357.000 i/100ms users.pluck(:created_at) 254.000 i/100ms Calculating ------------------------------------- users.pluck(:id) 3.628k (± 8.2%) i/s - 18.096k in 5.024748s users.pluck(:name) 3.624k (±12.4%) i/s - 17.850k in 5.020959s users.pluck(:created_at) 2.567k (± 7.0%) i/s - 12.954k in 5.081153s ``` After (this change with mysql2 adapter): ``` Warming up -------------------------------------- users.pluck(:id) 268.000 i/100ms users.pluck(:name) 265.000 i/100ms users.pluck(:created_at) 207.000 i/100ms Calculating ------------------------------------- users.pluck(:id) 2.586k (±10.9%) i/s - 12.864k in 5.050546s users.pluck(:name) 2.543k (±10.2%) i/s - 12.720k in 5.067726s users.pluck(:created_at) 2.263k (±14.5%) i/s - 10.971k in 5.004039s ```
* | | | | `:datetime` and `:time` columns allows `:precision` option [ci skip]Ryuta Kamizono2019-05-281-2/+3
|/ / / /
* | | | Merge pull request #36350 from kamipo/fast_pluckRyuta Kamizono2019-05-281-3/+5
|\ \ \ \ | | | | | | | | | | Allow symbol (i.e. quoted identifier) as safe SQL string
| * | | | Allow symbol (i.e. quoted identifier) as safe SQL stringRyuta Kamizono2019-05-281-3/+5
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `pluck(:id)` / `order(:id)` are very common use case, and passed symbol (i.e. quoted identifier) is obviously safe argument, but `:id.to_s.split(/\s*,\s*/).all? { |part| permit.match?(part) }` is useless and a bit expensive operation for each such safe symbols (will make extra 2 mutable strings, 1 array, 1 proc). This avoids the expensive operation to such safe symbols, it makes `pluck(:id)` / `order(:id)` itself about 9% faster. https://gist.github.com/kamipo/11d428b57f3629a72ae89c6f21721326 Before (93e640735e9363672b770b8d1c5a35f9e464f806): ``` Warming up -------------------------------------- users.pluck(:id) 1.217k i/100ms users.order(:id).to_sql 1.848k i/100ms Calculating ------------------------------------- users.pluck(:id) 12.239k (± 8.2%) i/s - 60.850k in 5.013839s users.order(:id).to_sql 19.111k (± 7.5%) i/s - 96.096k in 5.064450s ``` After (this change): ``` Warming up -------------------------------------- users.pluck(:id) 1.293k i/100ms users.order(:id).to_sql 2.036k i/100ms Calculating ------------------------------------- users.pluck(:id) 13.257k (± 6.9%) i/s - 65.943k in 5.002568s users.order(:id).to_sql 20.957k (± 7.6%) i/s - 105.872k in 5.086102s ```
* | | | Merge pull request #36348 from corprew/docs-stringify-keys-stable-resultRyuta Kamizono2019-05-281-8/+4
|\ \ \ \ | | | | | | | | | | | | | | | [documentation][ci skip] stringify_keys and symbolize_keys have stable results.
| * | | | stringify_keys and symbolize_keys have stable results.Corprew Reed2019-05-271-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails 6 uses the `Hash.transform_keys` found in Ruby 2.5 and later, and that method enumerates keys based on insertion order. Calling `symbolize_keys`, `stringify_keys`, and their bang variants will result in the same hash every time -- the value for any key where a collision occurs is the last assigned in that enumeration In the docs for Hash -- https://ruby-doc.org/core-2.5.0/Hash.html > Hashes enumerate their values in the order that the corresponding keys were inserted.
* | | | | Merge pull request #36347 from causztic/masterRyuta Kamizono2019-05-281-2/+0
|\ \ \ \ \ | | | | | | | | | | | | Remove unused requires from debug_exceptions
| * | | | | remove unused requires from debug_exceptionsyaojie2019-05-281-2/+0
|/ / / / /
* | | | | Merge pull request #36346 from corprew/day_of_week_doc_fixPrem Sichanugrist2019-05-281-1/+1
|\ \ \ \ \ | |/ / / / |/| | | | [documentation][ci skip] changes 'Week day' to 'day of week'
| * | | | changes 'Week day' to 'day of week'Corprew Reed2019-05-271-1/+1
|/ / / / | | | | | | | | | | | | | | | | 'Week day' has a specific meaning in English -- see https://en.wiktionary.org/wiki/weekday for details -- that is not meant here. 'Day of week' is more appropriate. [ci skip]
* | | | ruby < 2.5 is no longer supportedAkira Matsuda2019-05-282-17/+9
| | | |
* | | | Merge pull request #36345 from jhawthorn/weakref_reaperRafael França2019-05-271-11/+21
|\ \ \ \ | |/ / / |/| | | Use WeakRef in Reaper to avoid leaking connection pools
| * | | Use WeakRef to avoid leaking connection poolsJohn Hawthorn2019-05-271-11/+21
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to 3e2e8eeb9ea552bd4782538cf9348455f3d0e14a the Reaper thread would hold a reference to connection pools indefinitely, preventing the connection pool from being garbage collected, and also leaking the Thread. Since 3e2e8eeb9ea552bd4782538cf9348455f3d0e14a, there is only one Reaper Thread for all pools, however all pools are still stored in a class variable, preventing them from being garbage collected. This commit instead holds reference to the pools through a WeakRef. This way, connection pools referenced elsewhere will be reaped, any others will be able to be garbage collected. I don't love resorting to WeakRef to solve this, but I believe it's the simplest way to accomplish the the desired behaviour.
* | | Extract `readonly_attribute?`Ryuta Kamizono2019-05-273-6/+6
| | |
* | | Skip needless spaces from generated app layout.Kasper Timm Hansen2019-05-261-1/+1
| | |
* | | Merge pull request #36343 from edudepetris/update_commentsRyuta Kamizono2019-05-261-2/+2
|\ \ \ | | | | | | | | | | | | | | | | Change comments [ci skip]
| * | | Change commentsEdu Depetris2019-05-251-2/+2
|/ / /