aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | | | | | | Use released arelyuuji.yaginuma2017-11-156-6/+0
|/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to 2e0fe5928f0d08f85b4796c85bd0b39f6be09079
* | | | | | | | | | | Fix asset url examples [ci skip]Ryuta Kamizono2017-11-151-6/+6
| | | | | | | | | | |
* | | | | | | | | | | Fix CI failure due to invalid `up_only` for MySQLRyuta Kamizono2017-11-151-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `oldie = 'true'` to `tinyint(1)` column is invalid value for MySQL: ``` Mysql2::Error: Incorrect integer value: 'true' for column 'oldie' at row 1: update horses set oldie = 'true' ```
* | | | | | | | | | | Fix typo s/only_up/up_only/ [ci skip]Ryuta Kamizono2017-11-151-1/+1
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #30004 from npenzin/patch-1Yuji Yaginuma2017-11-152-2/+3
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Update plugin_generator.rb
| * | | | | | | | | | | Ensure plugin_generator adds to new line in GemfileNikita Penzin2017-11-142-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure plugin_generator adds to new line in Gemfile, even if the Gemfile does not end with an empty line. [Lisa Ugray, Nikita Penzin]
* | | | | | | | | | | | Merge pull request #31155 from bogdanvlviv/fix-activesupport-changelogRafael França2017-11-141-27/+29
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Fix activesupport/CHANGELOG.md [ci skip]
| * | | | | | | | | | | | Fix activesupport/CHANGELOG.md [ci skip]bogdanvlviv2017-11-141-27/+29
| | | | | | | | | | | | |
* | | | | | | | | | | | | Merge pull request #31154 from ↵Rafael França2017-11-141-1/+1
|\ \ \ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bogdanvlviv/fix-migration-version-in-doc-of-up_only Fix migration version in doc of #up_only
| * | | | | | | | | | | | Fix migration version in doc of #up_onlybogdanvlviv2017-11-141-1/+1
|/ / / / / / / / / / / /
* | | | | | | | | | | | Use released sass-railsRafael Mendonça França2017-11-142-15/+9
| | | | | | | | | | | |
* | | | | | | | | | | | Use released arelRafael Mendonça França2017-11-144-17/+9
| | | | | | | | | | | |
* | | | | | | | | | | | Merge pull request #30963 from ↵Rafael França2017-11-141-1/+14
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | q-centrix/performance-improvements-add_method_to_attributes Performance improvements for add_method_to_attributes!
| * | | | | | | | | | | | Performance improvements for add_method_to_attributes!Dillon Welch2017-11-071-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevents two string allocations per method call for common REST verbs plus a ~1.5x speedup for :get in particular ```ruby begin require "bundler/inline" rescue LoadError => e $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" raise e end gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" gem "rails" end def allocate_count GC.disable before = ObjectSpace.count_objects yield after = ObjectSpace.count_objects after.each { |k,v| after[k] = v - before[k] } after[:T_HASH] -= 1 # probe effect - we created the before hash. GC.enable result = after.reject { |k,v| v == 0 } GC.start result end @html_options = {} def master_version if @method && @method.to_s.downcase != "get" && @html_options["rel".freeze] !~ /nofollow/ @html_options["rel".freeze] = "#{@html_options["rel".freeze]} nofollow".lstrip end @html_options["data-method".freeze] = @method end def fast_version if method_not_get_method?(@method) && @html_options["rel".freeze] !~ /nofollow/ @html_options["rel".freeze] = "#{@html_options["rel".freeze]} nofollow".lstrip end @html_options["data-method".freeze] = @method end STRINGIFIED_COMMON_METHODS = { get: 'get', delete: 'delete', patch: 'patch', post: 'post', put: 'put', }.freeze def method_not_get_method?(method) return false unless method (STRINGIFIED_COMMON_METHODS[method] || method.to_s.downcase) != 'get' end puts 'get' @method = :get puts "master_version" puts allocate_count { 1000.times { master_version } } puts "fast_version" puts allocate_count { 1000.times { fast_version } } Benchmark.ips do |x| x.report("master_version") { master_version } x.report("fast_version") { fast_version } x.compare! end puts 'delete' @method = :delete puts "master_version" puts allocate_count { 1000.times { master_version } } puts "fast_version" puts allocate_count { 1000.times { fast_version } } Benchmark.ips do |x| x.report("master_version") { master_version } x.report("fast_version") { fast_version } x.compare! end ``` ``` get master_version {:FREE=>-1819, :T_STRING=>2052} fast_version {:FREE=>-1} Warming up -------------------------------------- master_version 140.839k i/100ms fast_version 175.639k i/100ms Calculating ------------------------------------- master_version 2.683M (± 7.1%) i/s - 13.380M in 5.013447s fast_version 3.988M (±10.1%) i/s - 19.847M in 5.039580s Comparison: fast_version: 3988340.3 i/s master_version: 2683336.2 i/s - 1.49x slower delete master_version {:FREE=>-5003, :T_STRING=>3003, :T_MATCH=>999, :T_IMEMO=>1000} fast_version {:FREE=>-3002, :T_STRING=>1001, :T_MATCH=>1000, :T_IMEMO=>1000} Warming up -------------------------------------- master_version 47.221k i/100ms fast_version 44.153k i/100ms Calculating ------------------------------------- master_version 597.881k (±11.4%) i/s - 2.975M in 5.047200s fast_version 686.014k (±11.6%) i/s - 3.400M in 5.036564s Comparison: fast_version: 686014.5 i/s master_version: 597881.4 i/s - same-ish: difference falls within error ```
* | | | | | | | | | | | | Add a #populate method to migrations (#31082)Rich2017-11-143-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a #populate method to migrations * Address rubocop issues * Rename to #up_only and use #execute in the examples intead of the model * Update CHANGELOG [Rich Daley & Rafael Mendonça França]
* | | | | | | | | | | | | Merge pull request #31153 from koic/ci_against_jruby_9_1_14_0Ryuta Kamizono2017-11-151-3/+3
|\ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | CI against JRuby 9.1.14.0
| * | | | | | | | | | | | | CI against JRuby 9.1.14.0Koichi ITO2017-11-151-3/+3
|/ / / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JRuby 9.1.14.0 has been released and this version is available on Travis CI. http://jruby.org/2017/11/08/jruby-9-1-14-0
* | | | | | | | | | | | | Introduce ActiveStorage::Attached::{One,Many}#detachGeorge Claghorn2017-11-143-7/+40
| | | | | | | | | | | | |
* | | | | | | | | | | | | Merge pull request #31151 from nikolai-b/exists_docRyuta Kamizono2017-11-141-1/+2
|\ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update `exists?` documentation [ci skip]
| * | | | | | | | | | | | | Update `exists?` documentationNikolai B2017-11-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it clear that `exists?` can be chained onto a relation
* | | | | | | | | | | | | | Merge pull request #30884 from robwold/patch-1Eileen M. Uchitelle2017-11-141-1/+1
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / / / / / |/| | | | | | | | | | | | | Update layouts_and_rendering.md [ci skip]
| * | | | | | | | | | | | | Update layouts_and_rendering.md [ci skip]Rob2017-11-141-1/+1
| | |_|_|_|_|_|_|_|/ / / / | |/| | | | | | | | | | |
* | | | | | | | | | | | | Merge pull request #27947 from mastahyeti/unsafe_raw_sqlMatthew Draper2017-11-1413-33/+462
|\ \ \ \ \ \ \ \ \ \ \ \ \ | |_|_|_|_|/ / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | Disallow raw SQL in dangerous AR methods
| * | | | | | | | | | | | use database agnostic function/quoting in testBen Toews2017-11-091-4/+4
| | | | | | | | | | | | |
| * | | | | | | | | | | | push order arg checks down to allow for bindsBen Toews2017-11-093-28/+47
| | | | | | | | | | | | |
| * | | | | | | | | | | | deal with Array arguments to #orderBen Toews2017-11-093-4/+22
| | | | | | | | | | | | |
| * | | | | | | | | | | | convert order arg to string before checking if we can reverse itBen Toews2017-11-092-2/+6
| | | | | | | | | | | | |
| * | | | | | | | | | | | use << instead of #concat in #reverse_sql_order because we might be working ↵Ben Toews2017-11-092-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with Arel SQL literator which overrides #concat
| * | | | | | | | | | | | try using regexesBen Toews2017-11-0927-166/+120
| | | | | | | | | | | | |
| * | | | | | | | | | | | allow table name and direction in string order argBen Toews2017-11-0927-244/+295
| | | | | | | | | | | | |
| * | | | | | | | | | | | work around deprecation warnings in a bunch of testsBen Toews2017-11-0934-313/+320
| | | | | | | | | | | | |
| * | | | | | | | | | | | always allow Arel::Attributes::Attribute alsoBen Toews2017-11-091-1/+3
| | | | | | | | | | | | |
| * | | | | | | | | | | | call enforce_raw_sql_whitelist on @klass so it works with FakeKlassBen Toews2017-11-091-2/+2
| | | | | | | | | | | | |
| * | | | | | | | | | | | work with actual string when reversing orderBen Toews2017-11-091-0/+3
| | | | | | | | | | | | |
| * | | | | | | | | | | | remove :enabled optionBen Toews2017-11-093-59/+52
| | | | | | | | | | | | |
| * | | | | | | | | | | | beef up deprecation warningBen Toews2017-11-091-3/+7
| | | | | | | | | | | | |
| * | | | | | | | | | | | make tests more verbose/explicitBen Toews2017-11-091-78/+96
| | | | | | | | | | | | |
| * | | | | | | | | | | | allow Arel.sql() for pluckBen Toews2017-11-098-101/+159
| | | | | | | | | | | | |
| * | | | | | | | | | | | add config to check arguments to unsafe AR methodsBen Toews2017-11-096-21/+293
| | | | | | | | | | | | |
* | | | | | | | | | | | | Cache: Enable compression by default for values > 1kB.Jeremy Daer2017-11-135-16/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compression has long been available, but opt-in and at a 16kB threshold. It wasn't enabled by default due to CPU cost. Today it's cheap and typical cache data is eminently compressible, such as HTML or JSON fragments. Compression dramatically reduces Memcached/Redis mem usage, which means the same cache servers can store more data, which means higher hit rates. To disable compression, pass `compress: false` to the initializer.
* | | | | | | | | | | | | Add `environment` as dependency of `load_config` (#31135)Yuji Yaginuma2017-11-142-26/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the environment is not loaded in some db tasks. Therefore, if use encrypted secrets values in `database.yml`, `read_encrypted_secrets` will not be true, so the value can not be used correctly. To fix this, added `environment` as dependency of `load_config`. It also removes explicit `environment` dependencies that are no longer needed. Fixes #30717
* | | | | | | | | | | | | Built-in Redis cache storeJeremy Daer2017-11-137-15/+684
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Supports vanilla Redis, hiredis, and Redis::Distributed. * Supports Memcached-like sharding across Redises with Redis::Distributed. * Fault tolerant. If the Redis server is unavailable, no exceptions are raised. Cache fetches are treated as misses and writes are dropped. * Local cache. Hot in-memory primary cache within block/middleware scope. * `read_/write_multi` support for Redis mget/mset. Use Redis::Distributed 4.0.1+ for distributed mget support. * `delete_matched` support for Redis KEYS globs.
* | | | | | | | | | | | | Merge pull request #30782 from NickLaMuro/improve_performance_of_inflectionsMatthew Draper2017-11-146-10/+31
|\ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cache regexps generated from acronym_regex
| * | | | | | | | | | | | | Deprecate ActiveSupport::Inflector#acronym_regexNick LaMuro2017-10-285-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To be removed in Rails 6.0 (default for the deprecate helper). Code moved around as well for the ActiveSupport::Deprecation modules, since it was dependent on ActiveSupport::Inflector being loaded for it to work. By "lazy loading" the Inflector code from within the Deprecation code, we can require ActiveSupport::Deprecation from ActiveSupport::Inflector and not get a circular dependency issue.
| * | | | | | | | | | | | | Cache regexps generated from acronym_regexNick LaMuro2017-10-233-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Problem ----------- The following line from `String#camelize`: string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { |match| match.downcase } and the following line from `String#camelize`: word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'.freeze }#{$2.downcase}" }#{$2.downcase}" } Both generate the same regexep in the first part of the `.sub`/`.gsub` method calls every time the function is called, creating an extra object allocation each time. The value of `acronym_regex` only changes if the user decides add an acronym to the current set of inflections and apends another string on the the regexp generated here, but beyond that it remains relatively static. This has been around since acronym support was introduced back in 2011 in PR#1648. Proposed Solution ----------------- To avoid re-generating these strings every time these methods are called, cache the values of these regular expressions in the `ActiveSupport::Inflector::Inflections` instance, making it so these regular expressions are only generated once, or when the acronym's are added to. Other notable changes is the attr_readers are nodoc'd, as they shouldn't really be public APIs for users. Also, the new method, define_acronym_regex_patterns, is the only method in charge of manipulating @acronym_regex, and initialize_dup also makes use of that new change. ** Note about fix for non-deterministic actionpack test ** With the introduction of `@acronym_underscore_regex` and `@acronym_camelize_regex`, tests that manipulated these for a short time, then reset them could caused test failures to happen. This happened because the previous way we reset the `@acronyms` and `@acronym_regex` was the set them using #instance_variable_set, which wouldn't run the #define_acronym_regex_patterns method. This has now been introduced into the actionpack tests to avoid this failure.
* | | | | | | | | | | | | | Merge pull request #31145 from dwightwatson/feature/preview-sortingRafael França2017-11-131-1/+1
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort mailer previews alphabetically
| * | | | | | | | | | | | | | Sort mailer previewsDwight Watson2017-11-141-1/+1
|/ / / / / / / / / / / / / /
* | | | | | | | | | | | | | Preserve existing metadata when analyzing a blobGeorge Claghorn2017-11-133-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #31138.
* | | | | | | | | | | | | | Merge pull request #31117 from renuo/fix_errors_addedRafael França2017-11-132-3/+14
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix bug on added? method
| * | | | | | | | | | | | | | fix bug on added? methodAlessandro Rodi2017-11-132-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix rubocop issues