- 22 7月, 2018 10 次提交
-
-
由 Orhan Toy 提交于
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.
-
由 Aaron Kromer 提交于
* 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
-
由 Kasper Timm Hansen 提交于
Clarify `railties/test/application/rake/notes_test.rb`
-
由 Kasper Timm Hansen 提交于
Use MethodCallAssertions instead of Mocha part 2
-
由 utilum 提交于
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.
-
由 utilum 提交于
A correct, but not obvious use of `ActiveSupport::Testing::MethodCallAssertions`, which might also have been part of #33337 or #33391.
-
由 utilum 提交于
-
由 Richard Schneeman 提交于
Separate min and max threads count environment variable for puma configuration
-
由 Richard Schneeman 提交于
Keep time_tag docs up-to-date.
-
由 George Claghorn 提交于
-
- 21 7月, 2018 15 次提交
-
-
由 Kasper Timm Hansen 提交于
Clarify example of the test `ActionController::HttpAuthentication::Token` [ci skip]
-
由 bogdanvlviv 提交于
Follow up #33401, 5491f811.
-
由 Richard Schneeman 提交于
ActiveRecord: limit() and primary_key
-
由 bogdanvlviv 提交于
After 1996fbe2 `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 1996fbe2.
-
由 Kasper Timm Hansen 提交于
Merge pull request #33408 from ycherniavskyi/fix_leaking_special_form_with_attributes_into_html_attributes Fix leaking special form_with attributes into html attributes
-
由 Chirag Shah 提交于
-
由 George Claghorn 提交于
Add a foreign-key constraint to the active_storage_attachments table for blobs
-
由 Yurii Cherniavskyi 提交于
Special form_with attributes `skip_default_ids` and `allow_method_names_outside_object` attributes are leaking into html attributes of option select tag helpers.
-
由 Kasper Timm Hansen 提交于
-
由 Kasper Timm Hansen 提交于
Wrap ActiveJob::Enqueue in evented ActiveSupport::Notification
-
由 Kasper Timm Hansen 提交于
Show nested exceptions on the debug view
-
由 Kasper Timm Hansen 提交于
Follow up to 9f152a60
-
由 Kasper Timm Hansen 提交于
-
由 Kasper Timm Hansen 提交于
-
由 Kasper Timm Hansen 提交于
Prevent `RequestEncoder#encode_params` to parse falsey params
-
- 20 7月, 2018 12 次提交
-
-
由 George Claghorn 提交于
-
由 George Claghorn 提交于
-
由 Alireza Bashiri 提交于
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
-
由 Brian Christian 提交于
-
由 Brian Christian 提交于
-
由 Brian Christian 提交于
-
由 yuuji.yaginuma 提交于
Also, added a test that a deprecated message will be output.
-
由 Rafael França 提交于
Fix problem with document expiration in ActionController::HttpAuthentication::Basic
-
由 黄松 提交于
-
由 George Claghorn 提交于
-
由 George Claghorn 提交于
-
由 George Claghorn 提交于
-
- 19 7月, 2018 3 次提交
-
-
由 Eileen M. Uchitelle 提交于
Avoid extra scoping in delegating to klass methods in the `scope` block
-
由 Ryuta Kamizono 提交于
Use MethodCallAssertions instead of Mocha#expects
-
由 Ryuta Kamizono 提交于
Since #29301, delegating to klass methods in the `scope` block would cause extra scoping by the receiver itself. The extra scoping would always override intermediate scoping like `unscoped` and caused the regression #33387. To keep the original scoping behavior, should avoid the extra scoping in the `scope` block. Fixes #33387.
-