aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge pull request #33451 from rails/event-object-subscriptionAaron Patterson2018-07-264-4/+120
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Add event object subscriptions to AS::Notifications
| * | | | | Add changelog entryAaron Patterson2018-07-261-0/+34
| | | | | |
| * | | | | fix arity check to use "parameters" for backwards compatAaron Patterson2018-07-261-4/+9
| | | | | |
| * | | | | Always subscribe to event objects via `AS::Notifications.subscribe`Aaron Patterson2018-07-263-21/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to have a special subscribe method for objects. The regular `subscribe` method is more expensive than a specialized method, but `subscribe` should not be called frequently. If that turns out to be a hotspot, we can introduce a specialized method. :)
| * | | | | Subscribe to event objects via `subscribe`Aaron Patterson2018-07-261-0/+12
| | | | | |
| * | | | | Subscribe to event objects via `subscribe_event`Aaron Patterson2018-07-263-1/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fanout notifier can send event objects to subscribers now. Also moved `end` lower in the `finish!` method to guarantee that CPU time is shorter than real time.
| * | | | | Match the units in `duration` (milliseconds)Aaron Patterson2018-07-261-1/+7
|/ / / / /
* | | | | Merge pull request #33449 from rails/use-process-clock-instead-of-timeAaron Patterson2018-07-264-4/+65
|\ \ \ \ \ | | | | | | | | | | | | Add cpu time, idle time, and allocations features to log subscriber events
| * | | | | Add cpu_time, idle_time, and allocations to EventEileen Uchitelle2018-07-264-4/+65
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use process clock instead of Time.now This fixes any issues with the system clock changing and also eliminates 2 object allocations per event. * Add start! and finish! methods to the event object so we can record more information * Adds cpu time, idle time, and allocation count for a particular event. Co-authored-by: Aaron Patterson <aaron.patterson@gmail.com>
* | | | | Merge pull request #33278 from koic/bump_rubocop_to_0_57_2George Claghorn2018-07-2610-287/+16
|\ \ \ \ \ | |/ / / / |/| | | | Bump RuboCop to 0.58.2
| * | | | Bump RuboCop to 0.58.2Koichi ITO2018-07-2610-287/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ## Summary RuboCop 0.58.2 was released. https://github.com/rubocop-hq/rubocop/releases/tag/v0.58.2 And rubocop-0-58 channel is available in Code Climate. https://github.com/codeclimate/codeclimate/releases/tag/v0.76.0 https://github.com/codeclimate/codeclimate/commit/38f21f0 In addition, the following changes are made in this PR. - Replace Custom cops with Rails cops - Add jaro_winkler gem to Gemfile.lock ### Replace Custom cops with Rails cops These are compatible replacements. - Replace `CustomCops/AssertNot` cop with `Rails/AssertNot` cop. - Replace `CustomCops/RefuteNot` cop with `Rails/RefuteMethods` cop. With this replacement, it was decided to use cop of RuboCop itself. It removes the code related to CustomCops accordingly. ### Add jaro_winkler gem to Gemfile.lock Since RuboCop 0.57.0 depends on jaro_winkler gem, it has been added to Gemfile.lock.
* | | | | Merge pull request #33436 from albertoalmagro/remove-thirdparty-fixmeEileen M. Uchitelle2018-07-261-2/+1
|\ \ \ \ \ | | | | | | | | | | | | Remove third party FIXME
| * | | | | Remove thirdparty FIXMEAlberto Almagro2018-07-251-2/+1
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | This FIXME belongs to a code example that was imported from the internet. As we aren't going to do anything about it, I prefer to remove it so it stops from appearing on searches.
* | | | | Merge pull request #33442 from utilum/ast_guide_setup_clarificationGeorge Claghorn2018-07-261-4/+4
|\ \ \ \ \ | | | | | | | | | | | | AST Guide: install and migrate tasks needed in new app
| * | | | | AST Guide: install and migrate tasks in new apputilum2018-07-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This line refers only to an upgrade situation, but same is need to setup AST in a new application. [ci skip]
* | | | | | Ignore ActiveRecord::InvalidForeignKey in ActiveStorage::Blob#purgeJasper Martin2018-07-265-3/+95
|/ / / / / | | | | | | | | | | Do nothing instead of raising an error when it’s called on an attached blob.
* | | | | Merge pull request #33440 from pwim/active-storage-linkRyuta Kamizono2018-07-261-1/+1
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | Reference Active Storage instead of third-party libraries in guide [ci skip]
| * | | | Reference Active Storage instead of third-party libraries in guidePaul McMahon2018-07-261-1/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Paperclip has officially been deprecated, so we shouldn't mention it anymore. CarrierWave could still be referenced, as there are use cases where it currently makes more sense, but for simplicity, I thought removing the mention of third party libraries made sense. If we want to talk about them, listing "alternatives" within the Active Storage guide could make more sense.
* | | | Merge pull request #32381 from q-centrix/update-codeclimate-configsRichard Schneeman2018-07-2530-111/+69
|\ \ \ \ | |/ / / |/| | | Turn on performance based cops
| * | | Turn on performance based copsDillon Welch2018-07-2330-111/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation
* | | | Merge pull request #33432 from damireh/patch-1George Claghorn2018-07-251-1/+1
|\ \ \ \ | | | | | | | | | | Update with_options.rb [ci skip]
| * | | | Update with_options.rbDaniel Amireh2018-07-251-1/+1
|/ / / / | | | | | | | | explicit mapping for enum accepts a Hash not an Array, plus the example is using `.keys` which also exists on hash
* | | | Normalize time value not to be affected by summer timeRyuta Kamizono2018-07-253-10/+41
| | | | | | | | | | | | | | | | Follow up of #33358 for SQLite3.
* | | | Merge pull request #33229 from ↵Matthew Draper2018-07-2546-304/+301
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails Prefer rails command over bin/rails
| * | | | Substitute references to task for commandAlberto Almagro2018-07-067-26/+26
| | | | | | | | | | | | | | | | | | | | This commit substitutes references to rails/rake task for rails command
| * | | | Show rails instead of bin/rails on USAGE instructionsAlberto Almagro2018-07-066-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | With this commit, rails commands usage instructions display now +rails+ instead of +bin/rails+ within their recommendations.
| * | | | Improve text readabilityAlberto Almagro2018-07-061-1/+1
| | | | |
| * | | | Homogenize rails commands and former rake tasksAlberto Almagro2018-07-061-58/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit integrates most used previously rake commands into the above outer list. Ordering is based on their individual predicted frequency of use. Separation between bin/rails tasks is also removed to display all commands at the same level. It also removes references to rake and tasks and substitutes them for command.
| * | | | Fix typo 'in via'Alberto Almagro2018-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | Substitutes 'in via' for 'by running'
| * | | | Recommend use of rails over bin/railsAlberto Almagro2018-07-0641-222/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together.
* | | | | Merge pull request #33426 from pwim/https-guide-linksEileen M. Uchitelle2018-07-2479-111/+111
|\ \ \ \ \ | | | | | | | | | | | | Rails guides are now served over https
| * | | | | Rails guides are now served over httpsPaul McMahon2018-07-2479-111/+111
|/ / / / / | | | | | | | | | | | | | | | | | | | | http links will be redirected to the https version, but still better to just directly link to the https version.
* | | | | Merge pull request #33371 from ↵Eileen M. Uchitelle2018-07-231-1/+10
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | lanzhiheng/change-the-text-color-which-wrapped-by-code-tag [ci skip] Change the text color which wrapped by code tag.
| * | | | Change the background color which wrapped by code tag. [ci skip]lanzhiheng2018-07-191-1/+10
| | | | |
* | | | | Merge pull request #30919 from seanlinsley/17622-before_save_strict_argumentsRyuta Kamizono2018-07-232-7/+36
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Add strict argument checking to ActiveRecord callbacks
| * | | | | add strict argument checking to ActiveRecord callbacksSean Linsley2018-07-222-7/+32
|/ / / / / | | | | | | | | | | | | | | | This ends up adding it to all save-related callbacks defined in `ActiveRecord::DefineCallbacks`, including e.g. `after_create`. Which should be fine: they didn't support `:on` in the first place.
* | | | | Merge pull request #33415 from orhantoy/feature/docs-consistent-hash-syntaxGeorge Claghorn2018-07-221-8/+8
|\ \ \ \ \ | | | | | | | | | | | | [ci skip] Use consistent hash syntax in AR docs
| * | | | | [ci skip] Use consistent hash syntax in AR docsOrhan Toy2018-07-221-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The examples with `.where` uses hash w/ symbol keys so it would be more consistent to also do this with `.new`. Also from my experience the hash w/ symbol keys is more widely used with `where/new/create` etc. in ActiveRecord.
* | | | | | Merge pull request #33416 from krmannix/masterGeorge Claghorn2018-07-221-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | [ci skip] fix typo in Active Record Associations guide
| * | | | | | [ci skip] fix typo in Associations guideK. Rodman Mannix2018-07-221-1/+1
| |/ / / / /
* | | | | | Merge pull request #33417 from orhantoy/feature/tidy-up-add_index-examplesGeorge Claghorn2018-07-221-12/+3
|\ \ \ \ \ \ | | | | | | | | | | | | | | [ci skip] Tidy up formatting of (consecutive) examples
| * | | | | | [ci skip] Tidy up formatting of examplesOrhan Toy2018-07-221-12/+3
| |/ / / / / | | | | | | | | | | | | | | | | | | The consecutive verbatim blocks were being merged making the output look weird.
* | | | | | Merge pull request #33418 from azbshiri/document-rendererRichard Schneeman2018-07-221-0/+15
|\ \ \ \ \ \ | |/ / / / / |/| | | | | [ci skip] Document render options
| * | | | | Add render options in action_controller/renderer for api documentation [ci skip]Alireza Bashiri2018-07-221-0/+15
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | Complete renderer documentation Fixes #28484
* | | | | Add implicit to path conversion to uploaded file (#28676)Aaron Kromer2018-07-223-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add implicit to path conversion to uploaded file Ruby has a few implicit conversion protocols (e.g. `to_hash`, `to_str`, `to_path`, etc.). These are considered implicit conversion protocols because in certain instances Ruby (MRI core objects) will check if an argument responds to the appropriate protocol and automatically convert it when it does; this is why you can provide a `Pathname` instance into `File.read` without having to explicitly call `to_s`. ```ruby a_file_path = 'some/path/file.ext' File.write a_file_path, 'String Path Content' File.read a_file_path a_pathname = Pathname(a_file_path) File.write core_file, 'Pathname Content' File.read a_file_path core_file = File.new(a_pathname) File.write core_file, 'File Content' File.read core_file tmp_file = Tempfile.new('example') File.write tmp_file, 'Tempfile Content' File.read tmp_file ``` So how does an uploaded file work in such cases? ```ruby tmp_file = Tempfile.new('example') File.write tmp_file, 'Uploaded Content' uploaded_file = ActionDispatch::Http::UploadedFile.new(tempfile: tmp_file) File.read uploaded_file ``` It fails with a `TypeError`: no implicit conversion of ActionDispatch::Http::UploadedFile into String In order to make an uploaded file work it must be explicitly converted to a file path using `path`. ```ruby File.read uploaded_file.path ``` This requires any code that expects path/file like objects to either special case an uploaded file, re-implement the path conversion protocol to use `path`, or forces the developer to explicitly cast uploaded files to paths. This last option can sometimes be difficult to do when such calls are deep within the inner workings of libraries. Since an uploaded file already has a path it makes sense to implement the implicit "path" conversion protocol (just like `File` and `Tempfile`). This change allows uploaded file content to be treated more closely to regular file content, without requiring any special case handling or explicit conversion for common file utilities. * Note uploaded file path delegation in CHANGELOG
* | | | | Merge pull request #33403 from ↵Kasper Timm Hansen2018-07-221-59/+58
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | bogdanvlviv/clarify-test_notes_finds_notes_in_custom_directories Clarify `railties/test/application/rake/notes_test.rb`
| * | | | | Clarify `railties/test/application/rake/notes_test.rb`bogdanvlviv2018-07-211-59/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After 1996fbe2a3e46ff5698bfa3812afb7f42cdfa899 `rails notes` isn't the same as `rake notes`. Since that, we should test `rake routes` instead of `rails notes` in `railties/test/application/rake/notes_test.rb` file. So I changed all occurrences of `rails routes` to `rake routes` in that file, and added assertions about deprecation warning of using `rake notes`. It will help to figure out that we should remove `railties/test/application/rake/notes_test.rb` entirely in favour of `railties/test/commands/notes_test.rb` that was added in 1996fbe2a3e46ff5698bfa3812afb7f42cdfa899.
* | | | | | Merge pull request #33409 from ↵Kasper Timm Hansen2018-07-224-49/+112
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | utilum/correct_epxectations_to_meet_minitest_strict_mocking Use MethodCallAssertions instead of Mocha part 2
| * | | | | | Replace permissive Mocha expectationsutilum2018-07-222-32/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Step 6 in #33162 When using Mocha like this: `ActiveRecord::Base.expects(:establish_connection).with(some_args)`, the expectations created look something like this: ``` @expectations= [#<Expectation:0x561350d968e0 expected exactly once, not yet invoked: ActiveRecord::Base.establish_connection("adapter" => "mysql2", "database" => nil) >, #<Expectation:0x561350dab8f8 allowed any number of times, not yet invoked: ActiveRecord::Base.establish_connection(any_parameters) >, #<Expectation:0x561350dc30c0 allowed any number of times, not yet invoked: ActiveRecord::Base.connection(any_parameters) >] ``` Minitest mocking (and the way we use it in `MethodCallAssertions`) expressly refuses to facilitate such permissiive expectations, insisting that all calls be specified in the actual expected order. This patch replaces such calls to `Mocha#expects` with `ActiveSupport::Testing::MethodCallAssertions` and specifies all expected calls in the epxected order.
| * | | | | | Replace Mocha#stubs with assert_called_withutilum2018-07-221-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A correct, but not obvious use of `ActiveSupport::Testing::MethodCallAssertions`, which might also have been part of #33337 or #33391.