aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Lazy allocate `@_start_transaction_state`Ryuta Kamizono2019-04-242-8/+10
| |/ / |/| |
* | | Merge pull request #36069 from st0012/remove-redundant-test-setupRafael França2019-04-231-21/+1
|\ \ \ | | | | | | | | Remove redundant test setups in log_subscriber_test
| * | | Remove redundant test setups in log_subscriber_testst00122019-04-241-21/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Because controllers' `perform_caching` config is `true` by default, it means we actually enable the caching in all those tests implicitly (and it works). Which also means we can avoid repeatedly declaring that and just specify it once in the setup method (just for declaration).
* | | | Merge pull request #36067 from st0012/update-generator-for-api-appRafael França2019-04-233-0/+11
|\ \ \ \ | | | | | | | | | | Remove action_controller.perform_caching from api app's configs
| * | | | Remove action_controller.perform_caching from api app's configsst00122019-04-243-0/+11
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As suggested in https://github.com/rails/rails/issues/35602#issuecomment-485833483, because we don't provide view caching and doesn't include `ActionController::Caching` for api apps, we should also avoid generating ```ruby config.action_controller.perform_caching = true ``` for those api apps. So it won't confuse people. **But because `perform_caching` will be `true` if not set, the behavior of the app would still be the same without these configs.**
* | | | Merge pull request #36070 from imechemi/fix-minor-api-docRyuta Kamizono2019-04-241-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Minor API doc fix [ci skip]
| * | | | Fix rdoc rendering for push alias symbolTenzin Chemi2019-04-231-1/+1
| | |/ / | |/| |
* | | | Merge pull request #35852 from larouxn/resurrectionRafael França2019-04-232-0/+9
|\ \ \ \ | | | | | | | | | | Resurrect external JS/CS generation
| * | | | Burn unnecessary files 🔥Nicholas La Roux2019-04-053-19/+0
| | | | |
| * | | | Style fixesNicholas La Roux2019-04-051-3/+3
| | | | |
| * | | | Resurrect generator templatesNicholas La Roux2019-04-052-0/+4
| | | | |
| * | | | Resurrect js/js engine options and generatorsNicholas La Roux2019-04-053-0/+24
| | | | |
* | | | | Rename local variable `n` to `name`Ryuta Kamizono2019-04-242-3/+3
| |/ / / |/| | |
* | | | Merge pull request #36066 from st0012/update-controller-cache-docRafael França2019-04-231-2/+2
|\ \ \ \ | | | | | | | | | | Update document about perform_caching's default value [ci skip]
| * | | | Update document about perform_caching's default valuest00122019-04-241-2/+2
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarify that both `config.action_controller.perform_caching` and `config.action_mailer.perform_caching`'s default are `true`. This default is set in `AbstractController::Caching`. One can verify this by commenting out all ``` @controller.perform_caching = true ``` in `actionpack/test/controller/caching_test.rb` and run the tests. They should still pass.
* | | | Make association builder methods privateRyuta Kamizono2019-04-247-1/+16
| | | |
* | | | Merge pull request #35928 from ↵Gannon McGibbon2019-04-231-1/+1
|\ \ \ \ | |/ / / |/| | | | | | | | | | | flanger001/form-with-does-not-generate-ids-by-default Make docs on form_with_generates_ids config option match the value
| * | | Make docs on form_with_generates_ids config option match the valueDavid Shaffer2019-04-231-1/+1
|/ / / | | | | | | | | | [skip ci]
* | | Merge pull request #36061 from shioyama/update_commentRafael França2019-04-231-2/+3
|\ \ \ | | | | | | | | Update comment in attribute_method_matchers_matching
| * | | Update comment in attribute_method_matchers_matchingChris Salzberg2019-04-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current comment here is from 2011 and its original context has changed completely. The plain matcher will not "match every time" anymore since the code now filters all matchers, and only selects those for which the captured attribute is valid. To avoid confusion, I updated the comment. For more discussion, see: https://github.com/rails/rails/pull/36005
* | | | Merge pull request #36063 from ↵Rafael França2019-04-231-8/+0
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | albertoalmagro/finish-documentation-for-after-save-commit Remove reminiscences from previous documentation
| * | | | Remove reminiscences from previous documentation [ci skip]Alberto Almagro2019-04-231-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #35861 documentation for `after_save_commit` was added, but also old documentation was adapted. I think adapting the old documentation is not necessary because there are already examples for `after_commit` on `:destroy` above. On top of that the action invoked by the callback on `:destroy` (`:log_user_saved_to_db`) talks about saving when the object is destroyed, which can be misleading. As I believe the documentation added by #35861 is already enough this patch removes the modified part, which made sense before adding docs for `after_save_commit` but is already covered by other parts of this guide.
* | | | | Merge pull request #36059 from composerinteralia/model-attribute-namesRafael França2019-04-232-0/+58
|\ \ \ \ \ | | | | | | | | | | | | Add attribute_names to ActiveModel::Attributes
| * | | | | Add attribute_names to ActiveModel::AttributesDaniel Colson2019-04-222-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds `.attribute_names` and `#attribute_names` to `ActiveModel::Attributes` along the same lines as the corresponding methods in `ActiveRecord::AttributeMethods` (see [`.attribute_names`][class_method] and [`#attribute_names`][instance_method]. While I was here I also added documentation for '#attributes', which I added in 043ce35b186. The whole class is still `#:nodoc:` so I don't think this will have any effect for now. [class_method]: https://github.com/rails/rails/blob/cc834db1d0815744cfa173813c05d928e008e167/activerecord/lib/active_record/attribute_methods.rb#L154-L160 [instance_method]: https://github.com/rails/rails/blob/cc834db1d0815744cfa173813c05d928e008e167/activerecord/lib/active_record/attribute_methods.rb#L299-L301
* | | | | | Merge pull request #36060 from st0012/fix-35602-docRafael França2019-04-231-0/+9
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add ActionController::Caching into api app's document [ci skip]
| * | | | | | Add ActionController::Caching into api app's documentst00122019-04-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails doesn't support view caching in api controllers by default but the document didn't clearerly declare this nor the manual config needed after including the module manually. So we'll see people get confused like #35602.
* | | | | | | Merge pull request #36057 from jhawthorn/activejob_retry_logicEileen M. Uchitelle2019-04-232-5/+37
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Use ActiveJob 5.2 retry logic for old jobs
| * | | | | | | Use ActiveJob 5.2 retry logic for old jobsJohn Hawthorn2019-04-222-5/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails 6 introduces retries per-exception, instead of a global count of retries. Because ActiveJob 5.2 doesn't serialize the execution count per-exception, when ActiveJob 6.0 picks up an "old" job it can't know the exception count in the new format. This can also be an issue if AJ 6.0 serializes a new job with exception_executions which is later picked up by AJ 5.2, which would clear exception_executions (since it has no knowledge of it). Previously we handled this by resetting exception_executions, if it wasn't defined on a job, which could result in the worst case retrying the job 2x the times we should. This commit changes how we handle loading a legacy job: instead of resetting exception_executions, we instead will always use the global executions count. This way, jobs which only have one retry_on (and didn't have a behaviour change in AJ 6) are backwards-and-forwards-compatible with counts respected exactly. Jobs with multiple retry_on will revert to the AJ5.2 behaviour if they were ever run under AJ5.2.
* | | | | | | | Add PR link for Active Storage updating release note entry [ci skip]Abhay Nikam2019-04-231-0/+1
| |_|_|/ / / / |/| | | | | |
* | | | | | | Merge pull request #36029 from kamipo/deprecate_where_notRyuta Kamizono2019-04-235-15/+118
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | Deprecate `where.not` working as NOR and will be changed to NAND in Rails 6.1
| * | | | | | Deprecate `where.not` working as NOR and will be changed to NAND in Rails 6.1Ryuta Kamizono2019-04-195-15/+118
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `where.not` with polymorphic association is partly fixed incidentally at 213796f (refer #33493, #26207, #17010, #16983, #14161), and I've added test case e9ba12f to avoid lose that fix accidentally in the future. In Rails 5.2, `where.not(polymorphic: object)` works as expected as NAND, but `where.not(polymorphic_type: object.class.polymorphic_name, polymorphic_id: object.id)` still unexpectedly works as NOR. To will make `where.not` working desiredly as NAND in Rails 6.1, this deprecates `where.not` working as NOR. If people want to continue NOR conditions, we'd encourage to them to `where.not` each conditions manually. ```ruby all = [treasures(:diamond), treasures(:sapphire), cars(:honda), treasures(:sapphire)] assert_equal all, PriceEstimate.all.map(&:estimate_of) ``` In Rails 6.0: ```ruby sapphire = treasures(:sapphire) nor = all.reject { |e| e.estimate_of_type == sapphire.class.polymorphic_name }.reject { |e| e.estimate_of_id == sapphire.id } assert_equal [cars(:honda)], nor without_sapphire = PriceEstimate.where.not( estimate_of_type: sapphire.class.polymorphic_name, estimate_of_id: sapphire.id ) assert_equal nor, without_sapphire.map(&:estimate_of) ``` In Rails 6.1: ```ruby sapphire = treasures(:sapphire) nand = all - [sapphire] assert_equal [treasures(:diamond), cars(:honda)], nand without_sapphire = PriceEstimate.where.not( estimate_of_type: sapphire.class.polymorphic_name, estimate_of_id: sapphire.id ) assert_equal nand, without_sapphire.map(&:estimate_of) ``` Resolves #31209.
* | | | | | Implements the task zeitwerk:checkXavier Noria2019-04-233-0/+90
| |_|/ / / |/| | | | | | | | | | | | | | [Matilda Smeds & Xavier Noria]
* | | | | upgrades Zeitwerk to 2.1.4Xavier Noria2019-04-235-65/+33
| |/ / / |/| | | | | | | | | | | | | | | | | | | This commit more or less undoes 9b5401f, restores autoloaded? not to touch the descendants tracker, and autoloaded_constants because it is documented in the guide.
* | | | Merge pull request #36058 from rails/revert-36038-fix-35602Rafael França2019-04-222-14/+0
|\ \ \ \ | | | | | | | | | | Revert "Include Caching module for ActionController::API"
| * | | | Revert "Include Caching module for ActionController::API"Rafael França2019-04-222-14/+0
|/ / / /
* | | | Merge pull request #36038 from st0012/fix-35602Guillermo Iguaran2019-04-222-0/+14
|\ \ \ \ | | | | | | | | | | Include Caching module for ActionController::API
| * | | | Make sure api controllers can perform caching as wellst00122019-04-192-0/+14
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently ActionController::API doesn't include Caching module, so it can't perform caching. And even if users include it later manually, it won't inherit application's default cache store for action_controllers. So the only way to solve this issue is to include Caching module in ActionController::API, too. This closes #35602
* | | | [ci skip] Active Storage: updating associations replacesKasper Timm Hansen2019-04-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Rails updating an Active Storage relation will now replace the entire association instead of merely adding to it. https://github.com/rails/rails/issues/35817#issuecomment-485512520 Fixes #35817 cc @georgeclaghorn
* | | | Allow sass-rails greater than 5.x in new appsGuillermo Iguaran2019-04-221-1/+1
| | | |
* | | | Make Action Text's rendering helpers more configurableJavan Makhmali2019-04-221-9/+14
| | | | | | | | | | | | | | | | | | | | - Allow configuring the sanitizer and its options - Split attachment rendering and sanitizing helpers so each can be overridden by applications
* | | | Avoid new string instance creation in `InsertAll#execute`Ryuta Kamizono2019-04-221-3/+3
| | | |
* | | | 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 ```