aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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
|/ / / / /
* | | | | Add missing period [ci skip]Rafael Mendonça França2019-07-161-1/+1
| | | | |
* | | | | Merge pull request #36692 from kirs/mysql2-adapter-timeoutRafael França2019-07-163-1/+23
|\ \ \ \ \ | | | | | | | | | | | | Raise specific exception on Mysql2::Error::TimeoutError
| * | | | | Raise specific exception on Mysql2::Error::TimeoutErrorKir Shatrov2019-07-163-1/+23
| | | | | |
* | | | | | Merge pull request #36648 from louim/patch-1Rafael França2019-07-161-2/+2
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | Update message verifier documentation [ci skip]
| * | | | | Update message verifier documentation [ci skip]Louis-Michel Couture2019-07-101-2/+2
| | | | | | | | | | | | | | | | | | Generate method of ActiveSupport Message verifier implied that the message is encrypted, but the message is simply Base64-encoded.
* | | | | | Merge pull request #36667 from ↵Gannon McGibbon2019-07-161-0/+3
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | | | | | | | | | | | | | gmcgibbon/clarify_logger_set_in_log_subscriber_docs Specify log subscribers need a logger set before they can receive events
| * | | | | Specify log subscribers need a logger set before they can receive eventsGannon McGibbon2019-07-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current example code for `ActiveSupport::LogSubscriber` mysteriously fails if you're using it outside of Rails. This helps clarify a logger needs to be set first before log subscribers can process events. [ci skip]
* | | | | | Merge pull request #36685 from Shopify/as-depedencies-unhook-fixRafael França2019-07-161-3/+23
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix Loadable.exclude_from to also reset Kernel#require
| * | | | | | Fix Loadable.exclude_from to also reset Kernel#requireJean Boussier2019-07-161-3/+23
| | | | | | |
* | | | | | | Merge pull request #36639 from Edouard-chin/ec-am-errors-fullmessagesRafael França2019-07-168-131/+173
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Move the `ActiveModel:Errors#full_message` method to the `Error` class:
| * | | | | | | Switch to use `class_attribute`:Edouard CHIN2019-07-162-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Since `ActiveModel::Error` can now be inherited by `ActiveModel::NestedError`, when the latter generates a `full_message`, the `i18n_customize_full_message` accessor set in the parent class is not set. This commit fixes that by using a `class_attribute` instead.
| * | | | | | | Move the `ActiveModel:Errors#full_message` method to the `Error` class:Edouard CHIN2019-07-168-131/+161
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - One regression introduced by the "AM errors as object" features is about the `full_messages` method. It's currently impossible to call that method if the `base` object passed in the constructor of `AM::Errors` doesn't respond to the `errors` method. That's because `full_messages` now makes a weird back and forth trip `AM::Errors#full_messages` -> `AM::Error#full_message` -> `AM::Errors#full_message` Since `full_message` (singular) isn't needed by AM::Errors, I moved it to the `AM::Error` (singular) class. This way we don't need to grab the `AM::Errors` object from the base.
* | | | | | | Reuse the exception class name in all places in the wrapperRafael Mendonça França2019-07-161-3/+4
| | | | | | |
* | | | | | | Make the selent exceptions configurable on the exception wrapperRafael Mendonça França2019-07-161-1/+5
| | | | | | |
* | | | | | | Merge pull request #31634 from afcapel/reduce-routing-error-log-noiseRafael Mendonça França2019-07-164-3/+34
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | Reduce log noise handling ActionController::RoutingErrors
| * | | | | | Reduce log noise handling ActionController::RoutingErrorsAlberto Fernández Capel2019-05-284-3/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each time a missing route is hit 32 lines of internal rails traces are written to the log. This is overly verbose and doesn't offer any actionable information to the user. With this change we'll still write an error message showing the route error but the trace will be omitted.
* | | | | | | Merge pull request #36557 from ↵Matthew Draper2019-07-162-3/+41
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sikachu/fix-source-annotation-extractor-annotation Fix problem with accessing deprecated constant proxy's subclass
| * | | | | | | Fix problem with accessing constant proxy subclassPrem Sichanugrist2019-07-052-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes #36313. After #32065 moved `SourceAnnotationExtractor` into `Rails` module, it broke the ability to access `SourceAnnotationExtractor::Annotate` directly as user would get this error: TypeError: Rails::SourceAnnotationExtractor is not a class/module This commit fixes the issue by making `DeprecatedConstantProxy` to inherit from `Module` and then defines `method_missing` and `const_missing` to retain the previous functionality. Thank you Matthew Draper for the idea of how to fix the issue! [Prem Sichanugrist & Matthew Draper]
* | | | | | | | Merge pull request #36672 from jbaranov/strong-params-hashRafael França2019-07-162-0/+13
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Add hash method to ActionController::Parameters
| * | | | | | | | Add hash method to ActionController::ParametersEugene Baranov2019-07-142-0/+13
| | | | | | | | |
* | | | | | | | | Merge pull request #36676 from ↵Rafael França2019-07-161-1/+1
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wjessop/change_activestorage_metadata_duration_to_bound Different versions of ffprobe can return subtly different video lengths
| * | | | | | | | | Different versions of ffprobe can return subtly different video lengthsWill Jessop2019-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specify a range so we can take this into account, but not get caught out by 0, nil or way too large values.
* | | | | | | | | | Merge pull request #36656 from Edouard-chin/ec-local-cache-referenceRafael França2019-07-152-1/+13
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Return a copy of the cache entry when local_cache exists:
| * | | | | | | | | | Return a copy of the cache entry when local_cache exists:Edouard CHIN2019-07-112-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - When the local cache exists (during the request lifecycle), the entry returned from the LocalStore is passed as a reference which means mutable object can accidentaly get modified. This behaviour seems unnecessarily unsafe and is prone to issues like it happened in our application. This patch dup the `Entry` returned from the cache and dup it's internal value.
* | | | | | | | | | | active_support/core_ext/object/duplicable is not in use hereRyuta Kamizono2019-07-162-2/+0
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #36654 from Edouard-chin/ec-errors-deleteRafael França2019-07-152-1/+7
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Returns `nil` when `AM::Errors#delete` doesn't delete anything:
| * | | | | | | | | | | Returns `nil` when `AM::Errors#delete` doesn't delete anything:Edouard CHIN2019-07-112-1/+7
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `AM::Errors#delete` currently returns an empty array when trying to delete an error that doesn't exist. This behaviour is surprising and I think it would be better to no return a truthy value but instead return nil like `Hash#delete` does.
* | | | | | | | | | | Merge pull request #36649 from Edouard-chin/ec-errors-strit-match-collectionRafael França2019-07-152-2/+24
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Fix `AM::Errors.added?` trying to generate a message:
| * | | | | | | | | | | Fix `AM::Errors.added?` trying to generate a message:Edouard CHIN2019-07-102-2/+24
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - When a ActiveRecord record get saved and validated as part of a collection association, the errors attribute are changed to reflect the children names. You end up with an error attribute that will look like this: `author.errors # {:'books.title' => [:blank]}` https://github.com/rails/rails/blob/2fe20cb55c76e6e50ec3a4ec5b03bbb65adba290/activerecord/lib/active_record/autosave_association.rb#L331-L340 We then can't check if the `books.title` errors was added using `ActiveModel::Errors#added?` because it tries to generate a message to make the match and end up calling the "books.title" method on the Author. ``` author.errors.added?(:'books.title', :blank) => NoMethodError: undefined method `books.title' ``` This patch modify the behaviour of `strict_match?` to not generate a message to make the comparison but instead make a strict comparison with the `options` from the error.
* | | | | | | | | | | Merge pull request #36640 from Edouard-chin/ec-uniq-validation-fixRafael França2019-07-152-2/+3
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Fix errors getting duplicated when passed validations options:
| * | | | | | | | | | | Fix errors getting duplicated when passed validations options:Edouard CHIN2019-07-102-2/+3
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In 86620cc3aa8e2630bc8d934b1a86453276b9eee9, a change was made on how we remove error duplication on a record for autosave association This fix has one caveat where validation having a `if` / `unless` options passed as a proc would be considered different. Example: ```ruby class Book < ApplicationRecord has_one :author validates :title, presence: true, if -> { true } validates :title, presence: true, if -> { true } end Book.new.valid? # false Book.errors.full_messages # ["title can't be blank", "title can't be blank"] ``` While this example might sound strange, I think it's better to ignore `AM::Validations` options (if, unless ...) when making the comparison.
* | | | | | | | | | | Remove caveat for older Ruby's `dup` behavior [ci skip]Ryuta Kamizono2019-07-161-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In older Ruby, nil, Symbol, Fixnum, Rational, and Complex were not duplicable. In Ruby 2.5, all of them are duplicable.
* | | | | | | | | | | Merge pull request #36684 from ↵Eileen M. Uchitelle2019-07-151-4/+0
|\ \ \ \ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | soartec-lab/fix/update_guide_active_support_not_mention_old_ruby Delete mention of Ruby 1.9 [skip ci]
| * | | | | | | | | | Delete mention of Ruby 1.9 [skip ci]soartec-lab2019-07-151-4/+0
| | |_|_|_|_|/ / / / | |/| | | | | | | |
* | | | | | | | | | Merge pull request #36532 from itsWill/add_to_a_to_annotated_source_codeGannon McGibbon2019-07-153-12/+29
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Empty array instead of nil for source_extract
| * | | | | | | | | | Empty array instead of nil for source_extractGuilherme Mansur2019-07-143-12/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The source_extract method will return nil when it can't find the file name in the backtrace, methods that consume this method expect an array and the nil ends up causing type errors down the road like it happened here: #36341. This patch refactors the source_extract method so that it returns an empty array instead of nil when it can't find the source code. Co-authored-by: Kasper Timm Hansen <kaspth@gmail.com>