aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Modify behaviour of `AM::Errors#to_h`:Edouard CHIN2019-07-232-4/+9
| | | | | | | | | | | | | | | | | | | | | - `AM::Error#to_h` was kind of broken before and would return in the hash values a single error message. ```ruby person = Person.new person.errors.add(:name, "cannot be blank") person.errors.add(:name, "too long") puts person.errors.to_h # {name: 'too long'} ``` Since an attribute can have different errors, the previous behavior didn't make much sense. Now, `ActiveModel::Errors#to_hash` correctly returns an array of error messages containing all the errors for an attribute. However, one can easily be surprised by this change, so let's deprecated it first.
* Merge pull request #36733 from ch3rub1m/fix-cache-timestamp-format-guideRafael França2019-07-231-1/+1
|\ | | | | Fix cache_timestamp_format default value in guides
| * Fix cache_timestamp_format default value in guidesch3rub1m2019-07-231-1/+1
| |
* | Merge pull request #36724 from Edouard-chin/ec-to-h-errorsRafael França2019-07-232-0/+16
|\ \ | | | | | | Deprecate `AM::Errors#to_h`:
| * | Deprecated `AM::Errors#to_h`:Edouard CHIN2019-07-232-0/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In ef4d3215b1198c456780b8d18aa62be7795b9b8c I made a change to pass `AM::Error` object in case the arity of the block passed to `each` accepted less than 2 arguments. This is causing one issue for `to_h` as it expects the argument passed to the block to be an Array (and were are passing it an instance of `AM::Error`). There is no real reason to use `to_h` anymore since `to_hash` exists Deprecating `to_h` inf favor of `to_hash` Co-Authored-By: Rafael França <rafael@franca.dev>
* | Improve changelog entry, remove extraneous word [ci skip]Carlos Antonio da Silva2019-07-231-2/+2
| |
* | Merge pull request #36666 from gmcgibbon/allow_disabling_active_storage_routesGannon McGibbon2019-07-226-1/+24
|\ \ | | | | | | Make Active Storage routes optional
| * | Make Active Storage routes optionalGannon McGibbon2019-07-226-1/+24
|/ / | | | | | | Add configuration option to turn off drawing of Active Storage routes.
* | Remove changelog entry for backported changeGeorge Claghorn2019-07-221-7/+0
| |
* | Merge pull request #36726 from ↵Rafael França2019-07-221-5/+5
|\ \ | | | | | | | | | | | | Edouard-chin/ec-source-annotation-extractor-deprecation Move the deprecation call after the new class has been defined:
| * | Move the deprecation call after the new class has been defined:Edouard CHIN2019-07-221-5/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - If we create the deprecation before the new class is defined this creates an issue in case you use a `TracePoint`. The `Tracepoint#return_value` will try to get the new class constant resulting in a uninitialized constant Rails::SourceAnnotationExtractor The problem can be reproduced like this: ```ruby @defined = Set.new ANONYMOUS_CLASS_DEFINITION_TRACEPOINT = TracePoint.new(:c_return) do |tp| next unless @defined.add?(tp.return_value) end ANONYMOUS_CLASS_DEFINITION_TRACEPOINT.enable require 'rails' require "rails/source_annotation_extractor" ```
* | Merge pull request #36623 from ↵George Claghorn2019-07-223-2/+44
|\ \ | |/ |/| | | | | alipman88/exclude_marshal_dump_from_delegate_missing_to Exclude marshal_dump & _dump methods from being delegated via delegate_missing_to extension, fix #36522
| * Omit marshal_dump & _dump from delegate_missing_toAaron Lipman2019-07-173-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Exclude missing marshal_dump and _dump methods from being delegated to an object's delegation target via the delegate_missing_to extension. This avoids unintentionally adding instance variables to an object during marshallization, should the delegation target be a method which would otherwise add them. In current versions of Ruby, a bug exists in the way objects are marshalled, allowing for instance variables to be added or removed during marshallization (see https://bugs.ruby-lang.org/issues/15968). This results in a corrupted serialized byte stream, causing an object's instance variables to "leak" into subsequent serialized objects during demarshallization. In Rails, this behavior may be triggered when marshalling an object that uses the delegate_missing_to extension, if the delegation target is a method which adds or removes instance variables to an object being marshalled - when calling Marshal.dump(object), Ruby's built in behavior will check whether the object responds to :marshal_dump or :_dump, which in turn triggers the delegation target method in the responds_to_missing? function defined in activesupport/lib/active_support/core_ext/module/delegation.rb While future versions of Ruby will resolve this bug by raising a RuntimeError, the underlying cause of this error may not be readily apparent when encountered by Rails developers. By excluding marshal_dump and _dump from being delegated to an object's target, this commit eliminates a potential cause of unexpected behavior and/or RuntimeErrors. Fixes #36522
* | Merge pull request #36723 from ↵Ryuta Kamizono2019-07-222-12/+51
|\ \ | | | | | | | | | | | | masakazutakewaka/fix_create_newline_between_blocks FIX: create a newline before group, github and source
| * | create a newline between blocks when gem_group, github and add_source was ↵masakazutakewaka2019-07-212-12/+51
|/ / | | | | | | called.
* | Merge pull request #36721 from Edouard-chin/ec-errors-eachCarlos Antonio da Silva2019-07-212-1/+9
|\ \ | | | | | | Fix deprecation on `AM::Errors` when each is called indirectly
| * | Fix deprecation on `AM::Errors` when each is called indirectly:Edouard CHIN2019-07-202-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `AM::Errors#each` is implemented for the `Enumerator` module and get called indirectly by a bunch of method in the ruby land (map, first, select ...) These methods have a `-1` arity as they are written in C and they wrongly trigger a deprecation warning. This commit fixes that and correctectly return a `AM::Error` object when `each` is called with a negative arity.
* | | Merge pull request #35285 from ↵y-yagi2019-07-212-16/+63
|\ \ \ | |/ / |/| | | | | | | | masakazutakewaka/fix_railtie_add_newline_to_gemfile_insertion Add a newline at the end of a Gemfile when it doesn't end with a newline
| * | Append a newline to the Gemfile if it doesn't end with a newlinemasakazutakewaka2019-07-192-16/+63
| | |
* | | Preserve existing attachment assignment behavior for upgraded appsGeorge Claghorn2019-07-209-15/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | Assigning to a collection of attachments appends rather than replacing, as in 5.2. Existing 5.2 apps that rely on this behavior will no longer break when they're upgraded to 6.0. For apps generated on 6.0 or newer, assigning replaces the existing attachments in the collection. #attach should be used to add new attachments to the collection without removing existing ones. I expect that we'll deprecate the old behavior in 6.1. Closes #36374.
* | | Fix argument in doc sample of new `sms_to` helper [ci skip]Carlos Antonio da Silva2019-07-191-1/+1
| | |
* | | Merge pull request #36511 from aantix/sms_link_helperGuillermo Iguaran2019-07-192-0/+110
|\ \ \ | | | | | | | | Helper method to create an sms link
| * | | Doc changes.Jim Jones2019-06-181-4/+4
| | | |
| * | | Helper method to create an sms link - when clicked it opens the ↵Jim Jones2019-06-182-0/+110
| | | | | | | | | | | | | | | | phone/desktop's messaging client with the phone number and optional body value prepopulated.
* | | | Merge pull request #36713 from Shopify/fix-type-in-templateKasper Timm Hansen2019-07-191-3/+3
|\ \ \ \ | | | | | | | | | | Fix a minor typo in ActionView::UnboundTemplate
| * | | | Fix a minor typo in ActionView::UnboundTemplateJean Boussier2019-07-191-3/+3
| | | | |
* | | | | Merge pull request #36706 from kirs/dedup-optimizer-hintsRyuta Kamizono2019-07-192-1/+8
|\ \ \ \ \ | | | | | | | | | | | | [ActiveRecord] Deduplicate optimizer hints
| * | | | | [ActiveRecord] Deduplicate optimizer hintsKir Shatrov2019-07-192-1/+8
| | | | | |
* | | | | | Merge pull request #36712 from tekin/include-more-commands-in-rails-help-outputEileen M. Uchitelle2019-07-191-4/+4
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Include common commands in rails help output
| * | | | | Include common commands in rails help outputTekin Suleyman2019-07-191-4/+4
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | With their descriptions commented out these commands were not included in the rails help command's output, which is a shame as they are useful, particularly during the development of more complex migrations.
* | | | | Merge pull request #36710 from ypresto/patch-1Ryuta Kamizono2019-07-191-1/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | [ActionController] Fix send_file example for 404 [ci skip]
| * | | | | [ActionController] Fix send_file example for 404Yuya Tanaka2019-07-191-1/+1
|/ / / / /
* | | | | Merge pull request #36703 from y-yagi/script-src-xxx_and_style-src-xxxy-yagi2019-07-192-0/+28
|\ \ \ \ \ | |/ / / / |/| | | | Add support for script-src-attr / elem and style-src-attr / elem directives
| * | | | Add support for script-src-attr / elem and style-src-attr / elem directivesyuuji.yaginuma2019-07-182-0/+28
| | |_|/ | |/| | | | | | | | | | | | | | These directives can be used in Chrome 75. Ref: https://www.chromestatus.com/feature/5141352765456384
* | | | Merge pull request #36695 from kamipo/revert_unnecessary_changeRyuta Kamizono2019-07-181-1/+1
|\ \ \ \ | |/ / / |/| | | Revert "Merge pull request #36676 from wjessop/change_activestorage_metadata_duration_to_bound"
| * | | Revert "Merge pull request #36676 from ↵Ryuta Kamizono2019-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wjessop/change_activestorage_metadata_duration_to_bound" This reverts commit a307c697b28e3c8b2860d2274c23e4d95dc164ae, reversing changes made to f30f76af747858826d3618866676cd5a4979e64a. Reason: This assertion is not failed even without this PR since both ffprobe versions (3.2.14 and 4.1.3) return the same duration 5.166648 for `video.mp4`. So there is no need to touch this assertion at this point.
* | | | Merge pull request #36603 from y-yagi/add_skip_collision_check_optionYuji Yaginuma2019-07-182-2/+15
|\ \ \ \ | | | | | | | | | | Add `skip-collision-check` option to generator
| * | | | Add `skip-collision-check` option to generatoryuuji.yaginuma2019-07-052-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until Rails 5.2, generators can run same name multi times without destroying. But Rails 6.0(with Zeitwerk) can't this. In Rails 6.0, an error occurs due to class name collision check. The check uses `const_defined?`, which assumes that the autoload object is also defined. https://ruby-doc.org/core-2.6.3/Module.html#method-i-const_defined-3F It did not work until Rails 5.2, but Zeitwerk seems to be able to correctly check this against the application's code. However, this is a little inconvenient if want to run the generator again like mistake an attribute name(need to run `destoy` before). In order to solve this, this PR adds an option to skip the collision check. With this option, you can overwrite files just as did until Rails 5.2.
* | | | | Merge pull request #36691 from Edouard-chin/ec-system-test-routeRafael França2019-07-172-6/+13
|\ \ \ \ \ | | | | | | | | | | | | Don't include routes helpers inside System test class:
| * | | | | Don't include routes helpers inside System test class:Edouard CHIN2019-07-162-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - https://github.com/rails/rails/pull/36283 made a change to make SystemTest inherits from ActiveSupport::TestCase instead of ActionDispatch::IntegrationTest. With this change, the route helpers are now directly included inside the SystemTest class. This causes an edge case in case you have a routes whos name starts with `test_`, minitest will consider it as a test and will try to run it https://github.com/seattlerb/minitest/blob/ab39d35fb4e84eb866ed9c4ecb707cbf3889de42/lib/minitest/test.rb#L66 This PR uses a proxy and deleted missing method to a dummy class that has all the route helpers.
* | | | | | Merge pull request #36700 from ↵Eileen M. Uchitelle2019-07-172-15/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | cpruitt/revert-36690-make-parameterize-requires-utf-8-explicit Revert "Make UTF-8 string requirement explicit for `ActiveSupport::Inflector.transliterate`"
| * | | | | | Revert "Make UTF-8 string requirement explicit for ↵Cliff Pruitt2019-07-172-15/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | `ActiveSupport::Inflector.transliterate`"
* | | | | | Merge pull request #36690 from cpruitt/make-parameterize-requires-utf-8-explicitEileen M. Uchitelle2019-07-172-2/+15
|\ \ \ \ \ \ | | | | | | | | | | | | | | Make UTF-8 string requirement explicit for `ActiveSupport::Inflector.transliterate`
| * | | | | | Make UTF-8 string requirement explicit for `transliterate`Cliff Pruitt2019-07-162-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's noted in #34062 that String#parameterize will raise an `Encoding::CompatibilityError` if the string is not UTF-8 encoded. The error is raised as a result of passing the string to `.unicode_normalize`. This PR raises a higher level `ArgumentError` if the provided string is not UTF-8 and updates documentation to note the encoding requirement.
* | | | | | | Merge pull request #36696 from inopinatus/support_beginless_rangesRyuta Kamizono2019-07-173-2/+30
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Support beginless ranges in hash conditions.
| * | | | | | | Support beginless ranges in hash conditions.Josh Goodall2019-07-173-2/+30
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ruby 2.7 introduces beginless ranges (..value and ...value) and as with endless ranges we can turn these into inequalities, enabling expressions such as Order.where(created_at: ..1.year.ago) User.where(karma: ...0)
* | | | | | | Merge pull request #36635 from ↵Kasper Timm Hansen2019-07-171-1/+1
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | abhaynikam/36332-fix-engine-documentation-to-remove-js-directory-mention Fixed the engine documentation to not mention of assets/javascript in directory structure [ci skip]
| * | | | | | Fixed the engine documentation to not mention of assets/javascripts in app ↵Abhay Nikam2019-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | directory structure [ci skip]
* | | | | | | Merge pull request #36694 from kirs/timeout-error-superclassRafael França2019-07-163-5/+12
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | [ActiveRecord] Superclass for aborted queries
| * | | | | | | [ActiveRecord] Superclass for aborted queriesKir Shatrov2019-07-163-5/+12
|/ / / / / / /