aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #33134 from dasch/dasch/extra-cache-controlsEileen M. Uchitelle2018-06-193-2/+28
|\ | | | | Add support for more HTTP cache controls
| * Add support for more HTTP cache controlsDaniel Schierbeck2018-06-133-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From <https://tools.ietf.org/html/rfc5861>: > The stale-if-error HTTP Cache-Control extension allows a cache to > return a stale response when an error -- e.g., a 500 Internal Server > Error, a network segment, or DNS failure -- is encountered, rather > than returning a "hard" error. This improves availability. > > The stale-while-revalidate HTTP Cache-Control extension allows a > cache to immediately return a stale response while it revalidates it > in the background, thereby hiding latency (both in the network and on > the server) from clients. These are useful, fully standardized parts of the HTTP protocol with widespread support among CDN vendors. Supporting them will make it easier to utilize reverse proxies and CDNs from Rails.
* | Merge pull request #33152 from bogdanvlviv/fix-ruby-version-fileRafael França2018-06-182-2/+8
|\ \ | | | | | | Fix Ruby version in `.ruby-version`
| * | Fix Ruby version in `.ruby-version`bogdanvlviv2018-06-182-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since #30016 Rails generates `.ruby-version` file in order to help Ruby version manager tools like `rbenv`, `rvm` determine which Ruby version should be used for the current Rails project. Since #32649 Rails sets Ruby version to the file compatible with MRI/JRuby by default. Pull Request #31496 reports that `.ruby-version` doesn't match ruby version other than stable version and recommends to use `ENV["RBENV_VERSION"]`, and `ENV["rvm_ruby_string"]` in order to set correct Ruby version to the file that `rbenv` or `rvm` can understand. Also, there is another similar issue that reports the same case if use JRuby https://github.com/jruby/jruby/issues/5144. Closes #31496, https://github.com/jruby/jruby/issues/5144.
* | | Merge pull request #33150 from vaidehijoshi/test-journey-or-tokenEileen M. Uchitelle2018-06-181-0/+6
|\ \ \ | | | | | | | | Add test case for the `|` token in Journey scanner
| * | | Add test case for the `|` token in Journey scannervaidehijoshi2018-06-181-0/+6
|/ / / | | | | | | | | | | | | | | | | | | Journey's scanner tokenizes the `|` (:OR) operator when scanning route urls such as `"/:foo|*bar"`. However, the current scanner test does not have any test cases for the `|` operator. This commit adds a test case for this particular token.
* | | Merge pull request #33147 from nsgc/add-api-document-about-migration-methodsRyuta Kamizono2018-06-181-0/+5
|\ \ \ | | | | | | | | Add docs for ActiveRecord::Migration#say, #say_with_time, #suppress_messages [ci skip]
| * | | Add docs for ActiveRecord::Migration#say, #say_with_time, #suppress_messages ↵Naoki Nishiguchi2018-06-181-0/+5
| | | | | | | | | | | | | | | | [ci skip]
* | | | Fix `touch` option to behave consistently with `Persistence#touch` methodRyuta Kamizono2018-06-1810-51/+98
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `touch` option was added to `increment!` (#27660) and `update_counters` (#26995). But that option behaves inconsistently with `Persistence#touch` method. If `touch` option is passed attribute names, it won't update update_at/on attributes unlike `Persistence#touch` method. Due to changed from `Persistence#touch` to `increment!` with `touch` option, #31405 has a regression that `counter_cache` with `touch` option which is passed attribute names won't update update_at/on attributes. I think that the inconsistency is not intended. To get back consistency, ensure that `touch` option updates update_at/on attributes.
* / / Remove unused requireyuuji.yaginuma2018-06-181-1/+0
|/ / | | | | | | `optparse` is unused since #26977.
* | Fix "warning: Net::HTTPResponse#header is obsolete"yuuji.yaginuma2018-06-171-1/+1
| | | | | | | | Ref: https://github.com/ruby/ruby/blob/cc77a811298bd7ab1c422f7f999b93c858327da9/lib/net/http/response.rb#L138-L155
* | Fix Active Storage configuration example [ci skip]yuuji.yaginuma2018-06-161-2/+2
| | | | | | | | It is necessary to specify a value to `config.active_storage`.
* | Merge pull request #33140 from bogdanvlviv/fix-rubocop-violationsYuji Yaginuma2018-06-151-1/+1
|\ \ | | | | | | Fix rubocop violations
| * | Fix rubocop violationsbogdanvlviv2018-06-151-1/+1
|/ / | | | | | | | | | | | | | | https://codeclimate.com/github/rails/rails/issues `bundle exec rubocop -a` Related to e4e1b62007fe40c4277ebc30067837a91bf25967
* | Merge pull request #33136 from Meekohi/masterRafael França2018-06-141-11/+9
|\ \ | | | | | | Update example for whitelisting arbitrary hashes
| * | Update example for whitelisting arbitrary hashesMichael Holroyd2018-06-141-11/+9
|/ / | | | | Since the ability to whitelist arbitrary hashes was added (https://github.com/rails/rails/issues/9454 was resolved by https://github.com/rails/rails/commit/e86524c0c5a26ceec92895c830d1355ae47a7034), this example is no longer outside of what strong_params can do. Moved this specific example out of the "Outside the Scope" section and into the regular "Examples" section, but left the "Outside the Scope" section as it was since the advice is still relevant for weirder whitelisting situations (maybe someone wants to add a new example that can't be handled natively).
* / Add missing documentation about `config.action_mailer.preview_interceptors` ↵yuuji.yaginuma2018-06-141-0/+6
|/ | | | [ci skip]
* Merge pull request #29373 from untidy-hair/store_accessor_enhanceRyuta Kamizono2018-06-135-7/+61
|\ | | | | | | Allow prefix/suffix options for store accessors
| * Update prefix and allow suffix options for store accessorsYukio Mizuta2018-06-124-5/+59
| |
* | Merge pull request #33131 from ↵Ryuta Kamizono2018-06-131-76/+56
|\ \ | | | | | | | | | | | | | | | | | | bogdanvlviv/update-active_support_core_extensions-guide Update "Active Support Core Extensions" Guide [ci skip]
| * | Update "Active Support Core Extensions" Guidebogdanvlviv2018-06-121-76/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove general sentence that explains that all methods that Active Support brings to `Date` `Time`, `DateTime` are defined in `active_support/core_ext/date/calculations.rb` since it isn't true. Add a references to an appropriate file where methods are defined like it is done with the other methods in this guide. Context https://github.com/rails/rails/pull/32552#discussion_r181216246 Related to #32543, #32552 [ci skip]
* | | Add ability to configure cache notifications infoEileen Uchitelle2018-06-122-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This may seem like an unnecessary refactoring but some apps want / need to configure the information passed to the query cache logger. In order to do that we can add a method here that can be easily overridden by the app itself, rather than hacking the query cache logger to include that information. To override apps can call ``` def cache_notifications_info super.merge(connected_host: "hostname") end ``` This will take what's already in the query cache logger and add `@something="yea"` to the object. At GitHub we use this to log the number of queries that are cached, the connection host and the connection url.
* | | Merge pull request #33127 from searls/patch-1Matthew Draper2018-06-121-1/+1
|\ \ \ | |/ / |/| | Remove reference to session_store.rb initializer
| * | Remove reference to session_store.rb initializerJustin Searls2018-06-121-1/+1
|/ / | | | | | | | | | | | | | | Rails no longer generates this file, but Google is still packed with results suggesting it should exist, so that the doc still pointed me to it threw me off (had I deleted it or something?). Probably be better to be vague and prompt the user to stick it in a config file they own. #33124
* | Merge pull request #33123 from siasmj/masterRyuta Kamizono2018-06-121-1/+1
|\ \ | | | | | | Add comma to example in guides/source/active_storage_overview.md [ci skip]
| * | Add comma to example in guides/source/active_storage_overview.md [ci skip]Matt Sias2018-06-111-1/+1
|/ /
* | Merge pull request #33121 from bogdanvlviv/add-changelog-for-32956Ryuta Kamizono2018-06-122-1/+7
|\ \ | | | | | | Add changelog for #32956 [ci skip]
| * | Add changelog for #32956 [ci skip]bogdanvlviv2018-06-122-1/+7
|/ / | | | | | | Add mention about default value of `config.active_model.i18n_full_message`.
* | Merge pull request #33120 from bogdanvlviv/fix-active_model-errors-docsRyuta Kamizono2018-06-122-2/+2
|\ \ | | | | | | Fix active_model/errors docs [ci skip]
| * | Fix active_model/errors docs [ci skip]bogdanvlviv2018-06-122-2/+2
| | | | | | | | | | | | | | | | | | | | | - Fix indentation. - Add a missing dot to the end of the sentence. Related to #32956
* | | Merge pull request #33119 from utilum/project_names_are_not_codeXavier Noria2018-06-112-5/+5
|\ \ \ | | | | | | | | Remove backticks around proejct names
| * | | Remove backticks around proejct namesutilum2018-06-112-5/+5
| | | | | | | | | | | | | | | | [ci skip]
* | | | Merge pull request #33118 from ↵Rafael França2018-06-112-1/+10
|\ \ \ \ | |/ / / |/| | | | | | | | | | | dan-jensen/fix-eager-load-lockup-bug-in-development Fix bug with eager_load in development environment
| * | | Fix bug with eager_load in development environmentDan Jensen2018-06-112-1/+10
| | | | | | | | | | | | | | | | | | | | Modifies the routes simulator to allow for empty RouteSets, which are created when secondary Engines are loaded.
* | | | Merge pull request #33106 from marcandre/datecalcRafael Mendonça França2018-06-111-15/+12
|\ \ \ \ | | | | | | | | | | | | | | | Improve some DateAndTime calculations
| * | | | Use fetch for better error handlingMarc-Andre Lafortune2018-06-091-2/+2
| | | | |
| * | | | Use same weekday correspondance as Date#wday.Marc-Andre Lafortune2018-06-091-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DeepCover revealed that most of these `wday != 0 ? wday - 1 : 6` were not entirely covered, i.e. the case of `wday == 0` was not tested: https://deep-cover.github.io/rails-cover/activesupport/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb.html#L351 There's actually no valid reason to consider Sunday a special case, so this commit simply reajusts the values used for calculations.
* | | | | Merge pull request #33092 from utilum/warnings_in_contribute_guideRafael França2018-06-111-6/+0
|\ \ \ \ \ | | | | | | | | | | | | Remove ineffective no-warnings flags from Contribute guide
| * | | | | Remove ineffective no-warnings flags from Contribute guideutilum2018-06-081-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | This is not working. [ci skip]
* | | | | | Merge pull request #32997 from utilum/dev_dep_guide_update_ast_requirementsRafael França2018-06-115-10/+39
|\ \ \ \ \ \ | | | | | | | | | | | | | | Dev-Dep guide: mention AST third party requirements
| * | | | | | Update ffmpeg -> FFmpeg, mutools|mupdf -> muPDFutilum2018-06-084-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
| * | | | | | Dev-Dep guide: mention AST third party requirementsutilum2018-06-082-5/+33
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid the likes of: ``` Error: ActiveStorage::RepresentationTest#test_representing_an_MP4_video: Errno::ENOENT: No such file or directory - ffmpeg test/models/representation_test.rb:27:in `block in <class:RepresentationTest>' ``` Also note additiona macOS requirements in ActiveStorage guide. [ci skip]
* | | | / / Don't use `target=`Rafael Mendonça França2018-06-112-2/+2
| |_|_|/ / |/| | | | | | | | | | | | | | | | | | | It mark the association as loaded and this can cause the object to be in an stale state.
* | | | | Merge pull request #33114 from utilum/redundant_accessorsRafael França2018-06-111-2/+0
|\ \ \ \ \ | | | | | | | | | | | | Remove redundant accessors in AC test stub
| * | | | | Remove redundant accessorsutilum2018-06-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | introduced in a0ea528b61.
* | | | | | Use `-=` to change the update the collection on the associationRafael Mendonça França2018-06-112-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also mark the association as loaded given we changed it in memory and avoid the next access to the reader to make a query to the databse.
* | | | | | Merge pull request #29939 from arthurchui/activerecord-delete-associations-loopRafael Mendonça França2018-06-111-1/+2
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | Use hash lookup for deleting existing associations from `target`
| * | | | | Use hash lookup for deleting existing associations from `target`Arthur Chui2017-07-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Array#delete` searches for all occurrences in the `target` array. When performing `dependent: :destroy` in active_record/associations/collection_association, the loop becomes O(N^2). It is particularly slow when destroying large amount of associations (e.g. 10K records). Either `Hash` or `Set` can optimize the loop to O(N). `Hash` is slightly faster in this simple usage. ```ruby class Dummy; end num = 10_000 test1a = num.times.map { Dummy.new }; nil test1b = test1a.dup test2a = num.times.map { Dummy.new }; nil test2b = test2a.dup Benchmark.ips do |x| x.config(stats: :bootstrap, confidence: 95) x.report("hash") do hash = test1a.group_by { |r| r } test1b.select! { |r| !hash[r] } end x.report("array") do test2a.each { |r| test2b.delete(r) } end x.compare! end ``` ``` Calculating ------------------------------------- hash 11.000 i/100ms array 1.000 i/100ms ------------------------------------------------- hash 114.586 (±16.6%) i/s - 561.000 array 1.710k (±10.3%) i/s - 8.377k Comparison: array: 1710.4 i/s hash: 114.6 i/s - 14.93x slower ```
* | | | | | Merge pull request #32956 from Shopify/i18n_activemodel_errors_full_messageRafael França2018-06-115-2/+135
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | Allow to override the full_message error format
| * | | | | Add global config for config.active_model.i18n_full_messageMartin Larochelle2018-06-055-1/+59
| | | | | |