aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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 #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.
| * | Fix Mocha replacement that slipped out of #33337utilum2018-07-221-11/+15
|/ /
* | Merge pull request #32984 from chiraggshah/min-thread-env-variableRichard Schneeman2018-07-211-2/+3
|\ \ | | | | | | Separate min and max threads count environment variable for puma configuration
| * | Modified the changes to make it backward compatibleChirag Shah2018-07-211-1/+1
| | |
| * | Separate min and max threads count for pumaChirag Shah2018-05-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Same environment variable RAILS_MAX_THREADS was being used for setting the minimum and maximum thread count for puma. This change makes it obvious and easy to decide which environment variable to change for setting the min or max. Don't feel like this is a breaking change as the same default is maintained.
* | | Merge pull request #33268 from benpickles/remove-pubdate-from-docsRichard Schneeman2018-07-211-2/+0
|\ \ \ | | | | | | | | Keep time_tag docs up-to-date.
| * | | Keep time_tag docs up-to-date.Ben Pickles2018-07-011-2/+0
| | | | | | | | | | | | | | | | | | | | The pubdate attribute was removed from the spec, see 940eec417f20e53abd3e3114c7fa845dac0d3a62 for context.
* | | | Remove unused attributeGeorge Claghorn2018-07-212-5/+5
| | | |
* | | | Merge pull request #33411 from bogdanvlviv/follow-up-33401-5491f8115711Kasper Timm Hansen2018-07-211-4/+3
|\ \ \ \ | | | | | | | | | | Clarify example of the test `ActionController::HttpAuthentication::Token` [ci skip]
| * | | | Clarify example of the test `ActionController::HttpAuthentication::Token` ↵bogdanvlviv2018-07-211-4/+3
|/ / / / | | | | | | | | | | | | | | | | | | | | [ci skip] Follow up #33401, 5491f8115711d8b34d52f8ba5e52ba39a49b08fe.
* | | | Merge pull request #24131 from brchristian/limit_and_primary_keyRichard Schneeman2018-07-213-1/+22
|\ \ \ \ | |_|_|/ |/| | | ActiveRecord: limit() and primary_key
| * | | CHANGELOG entryBrian Christian2018-07-191-0/+6
| | | |
| * | | don't impose primary key order if limit() is definedBrian Christian2018-07-191-1/+1
| | | |
| * | | tests for use of primary_key with limitBrian Christian2018-07-191-0/+15
| | | |
* | | | Merge pull request #33408 from ↵Kasper Timm Hansen2018-07-214-7/+25
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | ycherniavskyi/fix_leaking_special_form_with_attributes_into_html_attributes Fix leaking special form_with attributes into html attributes
| * | | | Fix leaking special form_with attributes into html attributesYurii Cherniavskyi2018-07-204-7/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Special form_with attributes `skip_default_ids` and `allow_method_names_outside_object` attributes are leaking into html attributes of option select tag helpers.
* | | | | Merge pull request #33405 from ↵George Claghorn2018-07-208-6/+25
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | georgeclaghorn/activestorage-referential-integrity Add a foreign-key constraint to the active_storage_attachments table for blobs
| * | | | Discard ActiveStorage::PurgeJobs on ActiveRecord::InvalidForeignKeyGeorge Claghorn2018-07-202-1/+11
| | | | |
| * | | | Test that ActiveStorage::Blob#purge fails when attachments existGeorge Claghorn2018-07-201-0/+8
| | | | |
| * | | | Add a foreign-key constraint to the attachments table for blobsGeorge Claghorn2018-07-193-2/+3
| | | | |
| * | | | Delete attachment before purging blobGeorge Claghorn2018-07-191-2/+2
| | | | |
| * | | | Destroy blob record before deleting stored dataGeorge Claghorn2018-07-191-1/+1
| | | | |
* | | | | [ci skip] Fixup changelog. Trim title. Mention benefit.Kasper Timm Hansen2018-07-202-5/+8
| | | | |
* | | | | Merge pull request #33171 from zvkemp/active-job-asn-wrap-enqueueKasper Timm Hansen2018-07-203-6/+27
|\ \ \ \ \ | | | | | | | | | | | | Wrap ActiveJob::Enqueue in evented ActiveSupport::Notification
| * | | | | Wrap ActiveJob::Enqueue in evented ActiveSupport::Notificationzvkemp2018-07-173-6/+27
| | | | | |
* | | | | | Merge pull request #32410 from yuki24/show-cause-on-debug-view-2Kasper Timm Hansen2018-07-2011-77/+189
|\ \ \ \ \ \ | | | | | | | | | | | | | | Show nested exceptions on the debug view
| * | | | | | Show nested exceptions on the debug viewYuki Nishijima2018-07-1511-77/+189
| | | | | | |
* | | | | | | [ci skip] Fix syntax error + make example easier to follow.Kasper Timm Hansen2018-07-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up to 9f152a606
* | | | | | | [ci skip] Strike changelog entry, since it's 5.2 backported.Kasper Timm Hansen2018-07-201-11/+0
| | | | | | |
* | | | | | | [ci skip] Move changelog entry up top. Clarify.Kasper Timm Hansen2018-07-201-7/+11
| | | | | | |
* | | | | | | Merge pull request #33392 from ↵Kasper Timm Hansen2018-07-203-1/+22
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | azbshiri/actionpack/prevent-request-encoder-to-parse-nil-params Prevent `RequestEncoder#encode_params` to parse falsey params
| * | | | | | Prevent `RequestEncoder#encode_params` to parse falsey paramsAlireza Bashiri2018-07-203-1/+22
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a `get` method called with `as: :json` and `params: nil` or `params: false` (explicitly or implicitly) `RequestEncoder#encode_params` converts it into a `null` or `false` value which includes a unexpected `null=` or `false` query string into request URL. From now on `RequestEncoder#encode_params` checks whether `params` is nil or not otherwise returns. Move down `nil` conversion guard Update CHANGELOG.md
* | | | | | Fix deprecation message for `SOURCE_ANNOTATION_DIRECTORIES`yuuji.yaginuma2018-07-202-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Also, added a test that a deprecated message will be output.
* | | | | | Merge pull request #33401 from pinewong/patch-1Rafael França2018-07-201-2/+2
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Fix problem with document expiration in ActionController::HttpAuthentication::Basic