aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* ActionCable: don't allowlist keys passed to the Redis initializerBlake Stoddard2019-04-222-3/+5
| | | Support all Redis features without needing to maintain a list of valid options that must stay in sync with the upstream client library.
* Don't table name qualify aggrigate column for virtual attributeRyuta Kamizono2019-04-221-4/+2
| | | | Related 0ee96d13de29680e148ccb8e5b68025f29fd091c.
* Merge pull request #36052 from kamipo/fast_idRyuta Kamizono2019-04-229-26/+30
|\ | | | | PERF: 20% faster pk attribute access
| * PERF: 20% faster pk attribute accessRyuta Kamizono2019-04-229-26/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've realized that `user.id` is 20% slower than `user.name` in the benchmark (https://github.com/rails/rails/pull/35987#issuecomment-483882480). The reason that performance difference is that `self.class.primary_key` method call is a bit slow. Avoiding that method call will make almost attribute access faster and `user.id` will be completely the same performance with `user.name`. Before (02b5b8cb): ``` Warming up -------------------------------------- user.id 140.535k i/100ms user['id'] 96.549k i/100ms user.name 158.110k i/100ms user['name'] 94.507k i/100ms user.changed? 19.003k i/100ms user.saved_changes? 25.404k i/100ms Calculating ------------------------------------- user.id 2.231M (± 0.9%) i/s - 11.243M in 5.040066s user['id'] 1.310M (± 1.3%) i/s - 6.565M in 5.012607s user.name 2.683M (± 1.2%) i/s - 13.439M in 5.009392s user['name'] 1.322M (± 0.9%) i/s - 6.615M in 5.003239s user.changed? 201.999k (±10.9%) i/s - 1.007M in 5.091195s user.saved_changes? 258.214k (±17.1%) i/s - 1.245M in 5.007421s ``` After (this change): ``` Warming up -------------------------------------- user.id 158.364k i/100ms user['id'] 106.412k i/100ms user.name 158.644k i/100ms user['name'] 107.518k i/100ms user.changed? 19.082k i/100ms user.saved_changes? 24.886k i/100ms Calculating ------------------------------------- user.id 2.768M (± 1.1%) i/s - 13.936M in 5.034957s user['id'] 1.507M (± 2.1%) i/s - 7.555M in 5.017211s user.name 2.727M (± 1.5%) i/s - 13.643M in 5.004766s user['name'] 1.521M (± 1.3%) i/s - 7.634M in 5.018321s user.changed? 200.865k (±11.1%) i/s - 992.264k in 5.044868s user.saved_changes? 269.652k (±10.5%) i/s - 1.344M in 5.077972s ```
* | Merge pull request #36040 from st0012/update-changelog-for-35145Eileen M. Uchitelle2019-04-221-0/+11
|\ \ | | | | | | Update changelog to explain the fix of #35114 [ci skip]
| * | Update the changelog to explain the fixst00122019-04-201-0/+11
| | |
* | | Merge pull request #36047 from rmacklin/take-screenshot-soonerEileen M. Uchitelle2019-04-223-5/+42
|\ \ \ | | | | | | | | Make system tests take failed screenshots in `before_teardown` hook
| * | | Make system tests take failed screenshots in `before_teardown` hookRichard Macklin2019-04-203-5/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we were calling the `take_failed_screenshot` method in an `after_teardown` hook. However, this means that other teardown hooks have to be executed before we take the screenshot. Since there can be dynamic updates to the page after the assertion fails and before we take a screenshot, it seems desirable to minimize that gap as much as possible. Taking the screenshot in a `before_teardown` rather than an `after_teardown` helps with that, and has a side benefit of allowing us to remove the nested `ensure` commented on here: https://github.com/rails/rails/pull/34411#discussion_r232819478
* | | | Remove useless `set_value` / `get_value` helper methodsRyuta Kamizono2019-04-222-17/+10
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Those helper methods makes relation values access 15% slower. https://gist.github.com/kamipo/e64439f7a206e1c5b5c69d92d982828e Before (02b5b8cb): ``` Warming up -------------------------------------- #limit_value 237.074k i/100ms #limit_value = 1 222.052k i/100ms Calculating ------------------------------------- #limit_value 6.477M (± 2.9%) i/s - 32.479M in 5.019475s #limit_value = 1 5.297M (± 4.3%) i/s - 26.424M in 4.999933s ``` After (this change): ``` Warming up -------------------------------------- #limit_value 261.109k i/100ms #limit_value = 1 239.646k i/100ms Calculating ------------------------------------- #limit_value 7.412M (± 1.6%) i/s - 37.077M in 5.003345s #limit_value = 1 6.134M (± 1.0%) i/s - 30.675M in 5.000908s ```
* | | Remove never used `database_selector` class accessorRyuta Kamizono2019-04-221-1/+0
| | | | | | | | | | | | It was never used from the beginning.
* | | Merge pull request #36045 from yfxie/fix-normalize-the-hash-of-transformationsGeorge Claghorn2019-04-212-1/+9
|\ \ \ | | | | | | | | ActiveStorage - normalize the hash of transformations
| * | | normalize the hash of transformationsYi Feng2019-04-202-1/+9
| | | |
* | | | Merge pull request #36051 from yoones/active-storage-bmp-variants-supportGeorge Claghorn2019-04-214-0/+17
|\ \ \ \ | | | | | | | | | | Allow ActiveStorage to generate variants of BMP images
| * | | | Allow ActiveStorage to generate variants of BMP imagesYounes SERRAJ2019-04-214-0/+17
| | |/ / | |/| |
* | | | Merge pull request #36049 from kamipo/avoid_method_callRyuta Kamizono2019-04-227-14/+14
|\ \ \ \ | | | | | | | | | | Avoid method call if `@transaction_state` is not finalized
| * | | | Avoid method call if `@transaction_state` is not finalizedRyuta Kamizono2019-04-217-14/+14
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Method call in Ruby is a bit slow. This makes attribute access 10% faster by avoiding method call (`sync_with_transaction_state`). Before (96cf7e0e): ``` Warming up -------------------------------------- user.id 131.291k i/100ms user['id'] 91.786k i/100ms user.name 151.605k i/100ms user['name'] 92.664k i/100ms user.changed? 17.772k i/100ms user.saved_changes? 23.909k i/100ms Calculating ------------------------------------- user.id 1.988M (± 7.0%) i/s - 9.978M in 5.051474s user['id'] 1.155M (± 5.8%) i/s - 5.783M in 5.022672s user.name 2.450M (± 4.3%) i/s - 12.280M in 5.021234s user['name'] 1.263M (± 2.1%) i/s - 6.394M in 5.066638s user.changed? 175.070k (±13.3%) i/s - 853.056k in 5.011555s user.saved_changes? 259.114k (±11.8%) i/s - 1.267M in 5.001260s ``` After (this change): ``` Warming up -------------------------------------- user.id 137.625k i/100ms user['id'] 96.054k i/100ms user.name 156.379k i/100ms user['name'] 94.795k i/100ms user.changed? 18.172k i/100ms user.saved_changes? 24.337k i/100ms Calculating ------------------------------------- user.id 2.201M (± 0.5%) i/s - 11.010M in 5.002955s user['id'] 1.320M (± 1.0%) i/s - 6.628M in 5.021293s user.name 2.677M (± 1.6%) i/s - 13.449M in 5.024399s user['name'] 1.314M (± 1.8%) i/s - 6.636M in 5.051444s user.changed? 190.588k (±11.1%) i/s - 944.944k in 5.065848s user.saved_changes? 262.782k (±12.1%) i/s - 1.290M in 5.028080s ```
* | | | Merge pull request #36048 from suretrust/masterKasper Timm Hansen2019-04-211-1/+1
|\ \ \ \ | |_|/ / |/| | | Fix typo by changing 'for' to 'from'
| * | | Fix typo by changing 'for' to 'from'Saheed Oladele2019-04-211-1/+1
|/ / /
* / / Add release notes for changes in the guides for Rails 6 [ci skip] (#36046)प्रथमेश Sonpatki2019-04-201-0/+9
|/ /
* | Merge pull request #36041 from ↵Ryuta Kamizono2019-04-202-3/+3
|\ \ | | | | | | | | | | | | abhaynikam/change-deprecation-for-dynamic-route-segment-to-6.1 Change the deprecation message for dynamic routes segment to 6.1
| * | Change deprecation message for dangerous query method to be disallowed in ↵Abhay Nikam2019-04-201-1/+1
| | | | | | | | | | | | Rails 6.1
| * | Change the deprecation message for dynamic routes segment to 6.1Abhay Nikam2019-04-201-2/+2
| | |
* | | Merge pull request #35896 from jlw/bug/active-jobless-seedsGannon McGibbon2019-04-203-1/+37
|\ \ \ | | | | | | | | [#35782] Allow loading seeds without ActiveJob (~> 5.2.3)
| * | | [#35782] Allow loading seeds without ActiveJob (~> 5.2.3)Jeremy Weathers2019-04-193-1/+37
| | | |
* | | | Merge pull request #35738 from gmcgibbon/aj_assert_drop_usec_docsGannon McGibbon2019-04-202-9/+28
|\ \ \ \ | | | | | | | | | | ActiveJob time argument assertion documentation
| * | | | Add section on asserting time args for jobsGannon McGibbon2019-03-251-0/+19
| | | | |
| * | | | Fix assert_performed_with time testsGannon McGibbon2019-03-251-9/+9
| | | | |
* | | | | Remove duplicated testyuuji.yaginuma2019-04-201-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With 8b4d344815655027d9f7584c0a59271dce8f1d5a, `test_required_polymorphic_belongs_to_generates_correct_model` and `test_required_and_polymorphic_are_order_independent` are completely same. Also, remove `required` from test name because that not passed to generator.
* | | | | Remove description for namespaced `db:migrate:up`eileencodes2019-04-191-1/+0
| |_|/ / |/| | | | | | | | | | | | | | | This was accidentally left in, the standard `db:migrate:up` doesn't have a description so `db:migrate:up:namespace` shouldn't have one either.
* | | | Merge pull request #36039 from ↵Eileen M. Uchitelle2019-04-193-1/+115
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | eileencodes/add-up-and-down-to-multi-db-rake-tasks Handle up/down for multiple databases
| * | | Handle up/down for multiple databaseseileencodes2019-04-193-1/+115
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds the ability to run up/down for a database in a multi-db environment. If you have an app with a primary and animals database the following tasks will be generated: ``` VERSION=123 rake db:migrate:up:primary VERSION=123 rake db:migrate:up:primary VERSION=123 rake db:migrate:down:primary VERSION=123 rake db:migrate:up:animals ``` I didn't generate descriptions with them since we don't generate a description for a single database application. In addition to this change I've made it so if your application has multiple databases Rails will raise if you try to run `up` or `down` without a namespace. This is because we don't know which DB you want to run `up` or `down` against unless the app tells us, so it's safer to just block it and recommend using namespaced versions of up/down respectively. The output for the raise looks like: ``` You're using a multiple database application. To use `db:migrate:down` you must run the namespaced task with a VERSION. Available tasks are db:migrate:down:primary and db:migrate:down:animals. ```
* | | Merge pull request #36001 from prathamesh-sonpatki/null-false-default-belongs-toKasper Timm Hansen2019-04-195-9/+104
|\ \ \ | | | | | | | | Add `null: false` constraint by default for `belongs_to` associations
| * | | Add `null: false` constraint by default for `belongs_to` associationsPrathamesh Sonpatki2019-04-195-9/+104
| | | | | | | | | | | | | | | | | | | | | | | | - Also deprecate passing {required} to the model generator. - Also made sure the global config `belongs_to_required_by_default` is applied correctly to the model generator for `null: false` option.
* | | | Revert "Deprecate `collection_cache_key` which is private API"Ryuta Kamizono2019-04-193-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f656bb301a43fe441af0039e4fafe40a7faa62f8. Reason: Test in Action View expects the `collection_cache_key` working... https://github.com/rails/rails/blob/ff6b713f5e729859995f204093ad3f8e08f39ea8/actionview/test/activerecord/relation_cache_test.rb#L21 https://github.com/rails/rails/blob/ff6b713f5e729859995f204093ad3f8e08f39ea8/actionview/test/fixtures/project.rb#L6 https://buildkite.com/rails/rails/builds/60609#d19181fb-fe80-4d1e-891c-1109b540fb4b/981-1009
* | | | Merge pull request #36000 from JosiMcClellan/fix-screenshot-filenamesEileen M. Uchitelle2019-04-192-1/+10
|\ \ \ \ | | | | | | | | | | handle long or duplicated screenshot filenames
| * | | | truncate screenshot filenames to avoid errorJosi McClellan2019-04-182-1/+10
| | | | |
* | | | | Merge pull request #35998 from itsWill/add_documentation_for_add_indexEileen M. Uchitelle2019-04-191-0/+20
|\ \ \ \ \ | | | | | | | | | | | | Document algorithm: concurrent option for PostgreSQL [ci skip]
| * | | | | Document algorithm: concurrent options for PostgreSQL [ci skip]Guilherme Mansur2019-04-161-0/+20
| | | | | |
* | | | | | Merge pull request #36037 from kamipo/deprecate_methodsRyuta Kamizono2019-04-192-26/+7
|\ \ \ \ \ \ | | | | | | | | | | | | | | Refactor `ActiveSupport::Deprecation.deprecate_methods` not to expose internal methods
| * | | | | | Refactor `ActiveSupport::Deprecation.deprecate_methods` not to expose ↵Ryuta Kamizono2019-04-192-26/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | internal methods In #33325, `deprecate_methods` is replaced from `prepend` to completely emurated `alias_method_chain`, it exposed two internal methods `xxx_with_deprecation` and `xxx_without_deprecation`. After that, #34648 restored the `prepend` implementation, which doesn't expose any internal methods, so we no longer be able to ensure to always expose that internal methods. As I said at https://github.com/rails/rails/pull/33325#issuecomment-409016725, I think that internal methods exposed is not a specification but a limitation when using `alias_method_chain`, there is no longer a reason to follow that limitation.
* | | | | | | Deprecate `collection_cache_key` which is private APIRyuta Kamizono2019-04-193-3/+9
| |_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `collection_cache_key` is private API for a long time, but I've maintained it in #35848 since it is mentioned in the doc (https://github.com/rails/rails/pull/35848#discussion_r272011475). The doc has removed at 1da9a7e4, so there is no longer a reason to maintain that private API.
* | | | | | Merge pull request #34788 from gsamokovarov/actionable-errorsKasper Timm Hansen2019-04-1920-3/+331
|\ \ \ \ \ \ | | | | | | | | | | | | | | Introduce Actionable Errors
| * | | | | | Refactor after the most recent code reviewGenadi Samokovarov2019-04-195-19/+19
| | | | | | |
| * | | | | | Dispatch actions only if config.consider_all_requests_local is setGenadi Samokovarov2019-04-192-1/+11
| | | | | | |
| * | | | | | Tweak the ActionableError docs a bitGenadi Samokovarov2019-04-191-4/+2
| | | | | | |
| * | | | | | Simplify the ActionableError.{dispatch,action} boundriesGenadi Samokovarov2019-04-193-3851/+75
| | | | | | |
| * | | | | | Drop the ambiguous `ActiveSupport::ActionableError#===` checkGenadi Samokovarov2019-04-194-26/+67
| | | | | | |
| * | | | | | Manage ActionDispatch::ActionableExceptions from the default middleware stackGenadi Samokovarov2019-04-195-62/+3827
| | | | | | |
| * | | | | | Make ActiveRecord::PendingMigrationError actionableGenadi Samokovarov2019-04-192-2/+10
| | | | | | |
| * | | | | | Introduce Actionable ErrorsGenadi Samokovarov2019-04-1915-2/+284
| | |_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actionable errors let's you dispatch actions from Rails' error pages. This can help you save time if you have a clear action for the resolution of common development errors. The de-facto example are pending migrations. Every time pending migrations are found, a middleware raises an error. With actionable errors, you can run the migrations right from the error page. Other examples include Rails plugins that need to run a rake task to setup themselves. They can now raise actionable errors to run the setup straight from the error pages. Here is how to define an actionable error: ```ruby class PendingMigrationError < MigrationError #:nodoc: include ActiveSupport::ActionableError action "Run pending migrations" do ActiveRecord::Tasks::DatabaseTasks.migrate end end ``` To make an error actionable, include the `ActiveSupport::ActionableError` module and invoke the `action` class macro to define the action. An action needs a name and a procedure to execute. The name is shown as the name of a button on the error pages. Once clicked, it will invoke the given procedure.