aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add `before?` and `after?` methods to date and time classesNick Holden2018-03-069-0/+63
| | | | | | | | Equality comparisons between dates and times can take some extra time to comprehend. I tend to think of a date or time as "before" or "after" another date or time, but I naturally read `<` and `>` as "less than" and "greater than." This change seeks to make date/time comparisons more human readable.
* [ci skip] Hide internal docs from root AS moduleAshe Connor2018-03-061-0/+1
| | | | | | | | | We have a bunch of documentation in lib/active_support/core_ext/object/json.rb which is currently appearing as documentation for the top-level ActiveSupport module. We hide it from rdoc here. Signed-off-by: Ashe Connor <ashe@kivikakk.ee>
* Don't call changes in `changes_applied` unless requiredSean Griffin2018-03-061-1/+3
| | | | | | This is an alternate implementation of #31698. That PR makes assumptions that I do not want in the code base. We can fix the performance regression with a much simpler patch.
* Revert "PERF: Recover `changes_applied` performance (#31698)"Sean Griffin2018-03-064-45/+75
| | | | This reverts commit a19e91f0fab13cca61acdb1f33e27be2323b9786.
* Provide an alternative PDF previewer based on PopplerTerence Lee2018-03-068-35/+104
| | | | | | mutool is licensed under the Affero GPL, which has strict distribution requirements. Poppler is licensed under the more liberal GPL, making it a good alternative for those who can't use mutool.
* Update test to reflect GCS direct upload header changeGeorge Claghorn2018-03-061-1/+1
|
* Allow selectively purging attached blobsNicholas Shirley2018-03-063-12/+46
|
* Remove blank Content-Type from GCS direct upload headersGeorge Claghorn2018-03-061-1/+1
| | | | Since we started clearing the client-side blob's type in e0867b3, we no longer need to set a blank Content-Type header before issuing the direct upload request. Fixes that Safari 9 would combine the blank Content-Type header with the blank blob type to produce a Content-Type header containing a single comma, invalidating the request.
* Merge pull request #32119 from fegorodscy/masterAndrew White2018-03-064-1/+58
|\ | | | | | | Fix dependence on has_one/belongs_to relationships
| * Fix dependence on has_one/belongs_to relationshipsFernando Gorodscy2018-03-064-1/+58
|/ | | | | | | | | | | | | | | | | | | | | | | | | | When a class has a belongs_to or has_one relationship with dependent: :destroy option enabled, objects of this class should not be deleted if it's dependents cannot be deleted. Example: class Parent has_one :child, dependent: :destroy end class Child belongs_to :parent, inverse_of: :child before_destroy { throw :abort } end c = Child.create p = Parent.create(child: c) p.destroy p.destroyed? # expected: false; actual: true; Fixes #32022
* Update Gemfile.lock to reflect Capybara 3.xYuji Yaginuma2018-03-061-1/+1
| | | | Follow up of #32151
* update comment to reflect new supported patterns [ci skip]Xavier Noria2018-03-061-0/+4
|
* Allow Capybara 3.x (#32151)Thomas Walpole2018-03-053-3/+3
|
* whitelist NULLS { FIRST | LAST } in order clausesXavier Noria2018-03-062-1/+28
|
* Fix purging dependent blobs when attachments aren't loadedGeorge Claghorn2018-03-054-25/+35
|
* Delete dependent attachments with recordGeorge Claghorn2018-03-053-2/+17
| | | | [Matt Jones & George Claghorn]
* Update skip_after_callbacks_if_terminated documentationRafael Mendonça França2018-03-051-2/+2
| | | | | Now we always have a terminator, so we don't need to day the options only make sense when the `:terminator` options is specified.
* Correct the ActiveStorage::Service#download_chunk docs [ci skip]George Claghorn2018-03-051-1/+1
|
* Fix that after commit callbacks on update does not triggered when optimistic ↵Ryuta Kamizono2018-03-063-53/+42
| | | | | | | | | | | | | | | | | | locking is enabled This issue is caused by `@_trigger_update_callback` won't be updated due to `_update_record` in `Locking::Optimistic` doesn't call `super` when optimistic locking is enabled. Now optimistic locking concern when updating is supported by `_update_row` low level API, therefore overriding `_update_record` is no longer necessary. Removing the method just fix the issue. Closes #29096. Closes #29321. Closes #30823.
* Generate root-relative paths in Active Storage disk service URL methodsGeorge Claghorn2018-03-0517-74/+66
| | | | Fixes #32129.
* Merge pull request #32174 from ↵Ryuta Kamizono2018-03-061-1/+1
|\ | | | | | | | | bogdanvlviv/remove-extra-passing-arg-to-run_routes_command Remove extra arg passed to `Rails::Command::RoutesTest#run_routes_command`
| * Remove extra arg passed to `Rails::Command::RoutesTest#run_routes_command`bogdanvlviv2018-03-051-1/+1
| | | | | | | | Related to 6bd33d66dde015a55912af20b469788ba20ddb4e
* | Merge pull request #32170 from koic/deprecate_safe_level_of_erb_new_in_ruby_2_6Ryuta Kamizono2018-03-052-2/+13
|\ \ | |/ |/| Deprecate safe_level of `ERB.new` in Ruby 2.6
| * Deprecate safe_level of `ERB.new` in Ruby 2.6Koichi ITO2018-03-052-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary In a Rails application using Ruby 2.6.0-dev, when running `bin/rails g migration` with `RUBYOPT=-w`, an ERB deprecation warnings will be displayed. ```console % ruby -v ruby 2.6.0dev (2018-03-03 trunk 62644) [x86_64-darwin17] % bin/rails -v Rails 6.0.0.alpha % RUBYOPT=-w bin/rails g migration create_foos (snip) /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments. /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead. /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead. create db/migrate/20180304002144_create_foos.rb ``` This PR suppresses the above deprecation warnings in Ruby 2.6.0-dev. This warning is due to the interface of `ERB.new` will change from Ruby 2.6. > Add :trim_mode and :eoutvar keyword arguments to ERB.new. > Now non-keyword arguments other than first one are softly deprecated > and will be removed when Ruby 2.5 becomes EOL. [Feature #14256] https://github.com/ruby/ruby/blob/2311087b685e8dc0f21f4a89875f25c22f5c39a9/NEWS#stdlib-updates-outstanding-ones-only The following addresses are related Ruby's commit. https://github.com/ruby/ruby/commit/cc777d0 Also this PR will change `ERB.new` used in `tasks/release.rb`. ### Other Information This PR uses `ERB.version` to switch `ERB.new` interface. Because Rails 6 supports multiple Ruby versions (Ruby 2.4.1 or higher), it need to use the appropriate interface. Using `ERB.version` instead of `RUBY_VERSON` is based on the following patch. https://github.com/ruby/ruby/pull/1826 This patch is built into Ruby. https://github.com/ruby/ruby/commit/40db89c0934c23d7464d47946bb682b9035411f9
* | Introduce `_update_row` to decouple optimistic locking concern from ↵Ryuta Kamizono2018-03-052-28/+45
| | | | | | | | `Persistence` module
* | Introduce `_delete_record` and use it for deleting a recordRyuta Kamizono2018-03-052-21/+23
| |
* | Prefer `_update_record` than `update_all` for updating a recordRyuta Kamizono2018-03-052-28/+35
| |
* | Refactor `_substitute_values` to be passed attribute names and valuesRyuta Kamizono2018-03-053-23/+15
| |
* | `id_in_database` should be respected as primary key value for persisted recordsRyuta Kamizono2018-03-053-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | Currently primary key value can not be updated if a record has a locking column because of `_update_record` in `Locking::Optimistic` doesn't respect `id_in_database` as primary key value unlike in `Persistence`. And also, if a record has dirty primary key value, it may destroy any other record by the lock version of dirty record itself. When updating/destroying persisted records, it should identify themselves by `id_in_database`, not by dirty primary key value.
* | Handle another case where a blob might be erroneously purgedGeorge Claghorn2018-03-042-5/+22
| |
* | Fix "NameError: undefined local variable or method `host'"yuuji.yaginuma2018-03-052-1/+7
| | | | | | | | The `host` and `port` can't use this context.
* | Avoid purging attached blob when replacing it with itselfGeorge Claghorn2018-03-042-2/+18
| |
* | [ci skip] Fix grammar in delegate, private: true docs.Kasper Timm Hansen2018-03-041-5/+4
| | | | | | | | | | | | | | | | | | Convert the user to atheism by ditching the extra example that demonstrates the same thing as date_of_birth. Demonstrate the NoMethodError on date_of_birth first, then call age that uses date_of_birth internally. Thus showing that accessing it publicly fails, but using it internally succeeds.
* | Merge pull request #32058 from gsamokovarov/rails-server-x-optionKasper Timm Hansen2018-03-048-61/+184
|\ \ | | | | | | Introduce explicit rails server handler option
| * | Extract Rails::Command::SpellcheckerGenadi Samokovarov2018-03-045-41/+65
| | |
| * | Introduce explicit rails server handler optionGenadi Samokovarov2018-03-043-20/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I mistype `rails server production` instead of `rails server -e production` expecting to lunch a server in the production environment all the time. However, the signature of `rails server --help` is: ``` Usage: rails server [puma, thin etc] [options] ``` This means that the `production` argument is being interpreted as a Rack server handler like Puma, Thin or Unicorn. Should we argue for the `rails server production`? I'm not sure of the reasons, but the `rails console production` behavior was deprecated in: https://github.com/rails/rails/pull/29358, so parity with the existing `rails console production` usage may not hold anymore. In any case, this PR introduces an explicit option for the Rack servers configuration. The option is called `--using` (or `-u` for short) to avoid the `rails server --server` tantrum. The new interface of `rails server` is: ``` Usage: rails server [using] [options] Options: -p, [--port=port] # Runs Rails on the specified port - defaults to 3000. -b, [--binding=IP] # Binds Rails to the specified IP - defaults to 'localhost' in development and '0.0.0.0' in other environments'. -c, [--config=file] # Uses a custom rackup configuration. # Default: config.ru -d, [--daemon], [--no-daemon] # Runs server as a Daemon. -e, [--environment=name] # Specifies the environment to run this server under (development/test/production). -u, [--using=name] # Specifies the Rack server used to run the application (thin/puma/webrick). -P, [--pid=PID] # Specifies the PID file. # Default: tmp/pids/server.pid -C, [--dev-caching], [--no-dev-caching] # Specifies whether to perform caching in development. [--early-hints], [--no-early-hints] # Enables HTTP/2 early hints. ``` As a bonus, if you mistype the server to use, you'll get an auto-correction message: ``` $ rails s tin Could not find handler "tin". Maybe you meant "thin" or "cgi"? Run `rails server --help` for more options. ```
* | | Fix routes command tests broken in e137831726.Kasper Timm Hansen2018-03-041-23/+16
| | |
* | | Merge pull request #32165 from bogdanvlviv/fix-occurrences-Fixnum-BignumRyuta Kamizono2018-03-055-19/+11
|\ \ \ | | | | | | | | Fix occurrences Fixnum|Bignum
| * | | Fix occurrences Fixnum|Bignumbogdanvlviv2018-03-045-19/+11
| | | | | | | | | | | | | | | | Related to https://github.com/rails/rails/commit/d4eb0dc89ee6b476e2e10869dc282a96f956c6c7#r27830891
* | | | Merge pull request #32166 from bogdanvlviv/fix-actionview-tests-executionKasper Timm Hansen2018-03-041-7/+8
|\ \ \ \ | |_|/ / |/| | | Fix actionview tests execution
| * | | Fix actionview tests executionbogdanvlviv2018-03-041-7/+8
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On my local environment execution of `cd actionview/ && bin/test` raises error: ``` (snip) rails/actionview/test/template/render_test.rb:6:in `<top (required)>': superclass mismatch for class TestController (TypeError) ``` In some test files `TestController` inherited from `ActionController::Base`, but in `test/actionpack/controller/render_test.rb` file `TestController` inherited from `ApplicationController`. This produces error `superclass mismatch for class TestController (TypeError)` Step to reproduce this on any environment: `cd actionview/ && bin/test test/template/streaming_render_test.rb test/actionpack/controller/render_test.rb`
* | | Merge pull request #32164 from ydakuka/patch-1Ryuta Kamizono2018-03-041-2/+2
|\ \ \ | |_|/ |/| | Fix links in the psql guide [ci skip]
| * | Fix links in the psql guide [ci skip]Yauheni Dakuka2018-03-041-2/+2
| | |
* | | Merge pull request #32162 from ↵Kasper Timm Hansen2018-03-047-100/+74
|\ \ \ | |/ / |/| | | | | | | | kaspth/ast-unify-preview-variant-routes-and-controllers Merge Previews/Variants controller into one Representations controller.
| * | Merge Previews/Variants controller into one Representations controller.Kasper Timm Hansen2018-03-037-100/+74
|/ / | | | | | | | | | | | | | | | | Since ActiveStorage::Blob::Representable unifies the idea of previews and variants under one roof as representation, we may as well have the controllers follow suit. Thus ActiveStorage::RepresenationsController enters the fray. I've copied the old tests for both previews and variants and unified those as well.
* / `id_in_database` do not return nil value for persisted recordRyuta Kamizono2018-03-042-4/+4
|/ | | | | This removes `|| id` which were added in #9963 and #23887 since it is no longer necessary.
* Eager loading with polymorphic associations should behave consistentlyRyuta Kamizono2018-03-043-9/+9
| | | | | | | | | | This reverts ignoring polymorphic error introduced at 02da8ae. What the ignoring want to solve was caused by force eager loading regardless of whether it is necessary, but it has been fixed by #29043. The ignoring is now only causing a mismatch of `exists?` behavior with `to_a`, `count`, etc. It should behave consistently.
* Extract all `base_class.name` as `polymorphic_name`Ryuta Kamizono2018-03-048-23/+43
| | | | | | | This is an alternative of #29722, and follow up of #32048. This does not change the current behavior, but makes it easier to modify all polymorphic names consistently.
* Fix RDoc formatting [ci skip]yuuji.yaginuma2018-03-031-1/+1
| | | | The `+` does not work if the string contains spaces.
* Deprecate "active_support/core_ext/numeric/inquiry"bogdanvlviv2018-03-024-108/+5
| | | | | | Numeric#positive? and Numeric#negative? was added to Ruby since 2.3, see https://github.com/ruby/ruby/blob/ruby_2_3/NEWS Rails 6 requires Ruby 2.4.1+ since https://github.com/rails/rails/pull/32034