aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge pull request #30471 from dylanahsmith/remove-redundant-trackerAaron Patterson2017-09-272-24/+10
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | activerecord: Remove a redundant mutation tracker
| * | | | | activerecord: Remove a redundant mutation trackerDylan Thacker-Smith2017-08-302-24/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The extra mutation tracker was needed in Rails 5.1 to preserve the old behaviour of `changes`, but now there is no difference between `changes` and `changes_to_save`, so `@mutation_tracker` can be removed.
* | | | | | Merge pull request #30729 from yalab/nested_scaffoldAaron Patterson2017-09-276-10/+75
|\ \ \ \ \ \ | | | | | | | | | | | | | | Nested scaffold should be fine
| * | | | | | scaffold nested name controller should be fine.yalab2017-09-276-10/+75
| | | | | | |
* | | | | | | Merge pull request #30614 from kami-zh/yarn-on-bin-updateJavan Makhmali2017-09-271-0/+5
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Align `bin/update`'s Yarn usage with `bin/setup`
| * | | | | | | Install JavaScript dependencies on updatekami-zh2017-09-161-0/+5
| | | | | | | |
* | | | | | | | Add newlines before/after the `git_source` in bug report templatesRyuta Kamizono2017-09-2711-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | | | Merge pull request #30728 from ↵Ryuta Kamizono2017-09-273-0/+16
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | y-yagi/ensure_transform_keys_of_hwida_to_return_hwida Ensure `HashWithIndifferentAccess#transform_keys` to return `HashWithIndifferentAccess`
| * | | | | | | Ensure `HashWithIndifferentAccess#transform_keys` to return ↵yuuji.yaginuma2017-09-273-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `HashWithIndifferentAccess` Currently, `#transform_values`, `#select` and `#reject` return instance of `HashWithIndifferentAccess`. But `#transform_keys` returns instance of Hash. This behavior is a bit confusing. I think that `HashWithIndifferentAccess#transform_keys` should also return instance of `HashWithIndifferentAccess` as well as other methods.
* | | | | | | | Add test case for `arel_attribute` with a custom tableRyuta Kamizono2017-09-272-1/+5
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | Since #29301, `arel_attribute` respects a custom table name.
* | | | | | | Merge pull request #30725 from ↵Sean Griffin2017-09-265-2/+81
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cheerful/record-milliseconds-in-postgres-timestamp-ranges Use `ActiveRecord::ConnectionAdapters::Quoting.quote` to quote bounds for a PostgreSQL range
| * | | | | | | `Postgres::OID::Range` serializes to a `Range`, quote in `Quoting`Thomas Cannon2017-09-265-2/+81
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PostgreSQL 9.1+ introduced range types, and Rails added support for using this datatype in ActiveRecord. However, the serialization of `PostgreSQL::OID::Range` was incomplete, because it did not properly quote the bounds that make up the range. A clear example of this is a `tsrange`. Normally, ActiveRecord quotes Date/Time objects to include the milliseconds. However, the way `PostgreSQL::OID::Range` serialized its bounds, the milliseconds were dropped. This meant that the value was incomplete and not equal to the submitted value. An example of normal timestamps vs. a `tsrange`. Note how the bounds for the range do not include their milliseconds (they were present in the ruby Range): UPDATE "iterations" SET "updated_at" = $1, "range" = $2 WHERE "iterations"."id" = $3 [["updated_at", "2017-09-23 17:07:01.304864"], ["range", "[2017-09-23 00:00:00 UTC,2017-09-23 23:59:59 UTC]"], ["id", 1234]] `PostgreSQL::OID::Range` serialized the range by interpolating a string for the range, which works for most cases, but does not work for timestamps: def serialize(value) if value.is_a?(::Range) from = type_cast_single_for_database(value.begin) to = type_cast_single_for_database(value.end) "[#{from},#{to}#{value.exclude_end? ? ')' : ']'}" else super end end (byebug) from = type_cast_single_for_database(value.begin) 2010-01-01 13:30:00 UTC (byebug) to = type_cast_single_for_database(value.end) 2011-02-02 19:30:00 UTC (byebug) "[#{from},#{to}#{value.exclude_end? ? ')' : ']'}" "[2010-01-01 13:30:00 UTC,2011-02-02 19:30:00 UTC)" @sgrif (the original implementer for Postgres Range support) provided some feedback about where the quoting should occur: Yeah, quoting at all is definitely wrong here. I'm not sure what I was thinking in 02579b5, but what this is doing is definitely in the wrong place. It should probably just be returning a range of subtype.serialize(value.begin) and subtype.serialize(value.end), and letting the adapter handle the rest. `Postgres::OID::Range` now returns a `Range` object, and `ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting` can now encode and quote a `Range`: def encode_range(range) "[#{type_cast(range.first)},#{type_cast(range.last)}#{range.exclude_end? ? ')' : ']'}" end ... encode_range(range) #=> "['2010-01-01 13:30:00.670277','2011-02-02 19:30:00.745125')" This commit includes tests to make sure the milliseconds are preserved in `tsrange` and `tstzrange` columns
* | | | | | | Include `ActionDispatch::DrawOnce` in `ActiveSupport::TestCase`Ryuta Kamizono2017-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is also used in `BlockTestCase`.
* | | | | | | Remove unused code that was copied from actionpackRyuta Kamizono2017-09-271-52/+1
| |_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | `abstract_unit.rb` in actionview was copied from actionpack in the commit eb23754e. But some part is never used for actionview's tests.
* | | | | | Remove unused `cached_columns` and `time_related_columns_on_topic` in ↵Ryuta Kamizono2017-09-271-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `AttributeMethodsTest` These are no longer used since 66736c8e.
* | | | | | Merge pull request #30726 from bogdanvlviv/improve-bug_report_templatesRyuta Kamizono2017-09-2711-0/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | Change :github git source for bug report templates
| * | | | | | Change :github git source for bug report templatesbogdanvlviv2017-09-2711-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | :github source uses `git://` url by default, `https://` is recommended. See http://bundler.io/v1.15/guides/git.html#security We do the same in our `Gemfile` and templates.
* | | | | | | Don't generate `foreign_type` if `options[:polymorphic]` is not givenRyuta Kamizono2017-09-271-1/+1
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Because the reflection doesn't have `foreign_type` unless the association is a polymorphic association.
* | | | | | Merge pull request #30713 from yhirano55/add_a_space_to_refinery_cmsJavan Makhmali2017-09-261-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add a space to RefineryCMS in Engine guide [ci skip]
| * | | | | | Add an space to RefineryCMS in Engine guide [ci skip]Yoshiyuki Hirano2017-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * According to the official website, it seems that "RefineryCMS" is "Refinery CMS". * See at: http://www.refinerycms.com/
* | | | | | | Treat `Set` as an `Array` in `Relation#where`Sean Griffin2017-09-263-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I do not want to set the expectation that any enumerable object should behave this way, but this case in particular comes up frequently enough that I'm caving on this one. Fixes #30684.
* | | | | | | Merge pull request #30550 from tgxworld/fix_memoization_preloadSean Griffin2017-09-264-15/+13
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | PERF: Partially recover some performance when preloading.
| * | | | | | | PERF: Partially recover some performance when preloading.Guo Xiang Tan2017-09-264-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benchmark Script: ``` require 'active_record' require 'benchmark/ips' ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false ActiveRecord::Schema.define do create_table :users, force: true do |t| t.string :name, :email t.integer :topic_id t.timestamps null: false end create_table :topics, force: true do |t| t.string :title t.timestamps null: false end end attributes = { name: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', email: 'foobar@email.com' } class Topic < ActiveRecord::Base has_many :users end class User < ActiveRecord::Base belongs_to :topic end 100.times do User.create!(attributes) end users = User.first(50) Topic.create!(title: 'This is a topic', users: users) Benchmark.ips do |x| x.config(time: 10, warmup: 5) x.report("preload") do User.includes(:topic).all.to_a end end ``` Before: ``` Calculating ------------------------------------- preload 40.000 i/100ms ------------------------------------------------- preload 407.962 (± 1.5%) i/s - 4.080k ``` After: ``` alculating ------------------------------------- preload 43.000 i/100ms ------------------------------------------------- preload 427.567 (± 1.6%) i/s - 4.300k ```
* | | | | | | | Merge pull request #30724 from hupfis/patch-1Matthew Draper2017-09-261-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix typo in 'find_in_batches' example
| * | | | | | | | Fix typo in 'find_in_batches' examplehupfis2017-09-261-1/+1
|/ / / / / / / /
* | | | | | | | Merge pull request #30721 from yalab/fix_rake_installMatthew Draper2017-09-261-0/+2
|\ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ |/| | | | | | | Fixed broken `bundle exec rake install`
| * | | | | | | Fixed broken `bundle exec rake install`yalab2017-09-261-0/+2
|/ / / / / / /
* / / / / / / Fix indentation in CHANGELOG [ci skip]Ryuta Kamizono2017-09-261-3/+3
|/ / / / / /
* | | | | | Merge pull request #30715 from y-yagi/remove_unused_fixturesRyuta Kamizono2017-09-263-7/+0
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove unused fixtures
| * | | | | | Remove unused fixturesyuuji.yaginuma2017-09-263-7/+0
|/ / / / / / | | | | | | | | | | | | | | | | | | `about_yml_plugins` is no longer used since 82b9b15
* | | | | | [ci skip] Don't mention unrotatable secret_key_base.Kasper Timm Hansen2017-09-251-18/+20
| | | | | |
* | | | | | Merge pull request #30705 from frodsan/use-digest-thread-safeMatthew Draper2017-09-262-2/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Preload digest/sha2 to avoid thread safe error.
| * | | | | | Preload digest/sha2 to avoid thread safe error.Francesco Rodriguez2017-09-252-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I got this error in production using Puma in multi-threaded mode: ``` RuntimeError: Digest::Base cannot be directly inherited in Ruby from active_support/security_utils.rb:23:in `variable_size_secure_compare' from active_support/security_utils.rb:23:in `hexdigest' from active_support/security_utils.rb:23:in `digest' ``` Looks like Digest uses const_missing to load Digest::SHA256 (https://github.com/ruby/ruby/blob/trunk/ext/digest/lib/digest.rb#L8) - https://bugs.ruby-lang.org/issues/9494 - https://github.com/ruby/ruby/commit/c02fa39463a0c6bf698b01bc610135604aca2ff4
* | | | | | | Merge pull request #30700 from y-yagi/respect_quiet_optionKasper Timm Hansen2017-09-253-17/+22
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | Respect quiet option in all process of `rails new` command
| * | | | | | Respect quiet option in all process of `rails new` commandyuuji.yaginuma2017-09-253-17/+22
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | If specify the `quiet` option, expect that no status will be shown. However, some process show status. This suppresses all status output.
* | | | | | Merge pull request #30703 from dixpac/fix_minor_code_climate_issueKasper Timm Hansen2017-09-251-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix minor CodeClimate issue
| * | | | | | Fix minor CodeClimate issuedixpac2017-09-251-1/+1
| |/ / / / /
* | | | | / Fix cookies/session tests broken after merging key rotation.Kasper Timm Hansen2017-09-253-37/+34
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on, yet closes https://github.com/rails/rails/pull/30708 Fix the session test by properly truncating the legacy encryption key for cbc encryption. Borrowed straight from 👆. Fix the cookies test a little differently than the PR. Basically keep every config within the config block. [ Michael Coyne & Kasper Timm Hansen ]
* | | | | Merge pull request #30704 from ydakuka/new-fixesRyuta Kamizono2017-09-252-3/+3
|\ \ \ \ \ | | | | | | | | | | | | New missing backquotes [ci skip]
| * | | | | new missing backquotes [ci skip]Yauheni Dakuka2017-09-252-3/+3
| | | | | |
* | | | | | Merge pull request #30706 from tgxworld/fix_preload_memoizationRyuta Kamizono2017-09-251-6/+5
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | PERF: Restore memoization when preloading associations.
| * | | | | PERF: Restore memoization when preloading associations.Guo Xiang Tan2017-09-251-6/+5
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benchmark Script ``` require 'active_record' require 'benchmark/ips' require 'ruby-prof' require 'memory_profiler' require 'byebug' ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL')) ActiveRecord::Migration.verbose = false ActiveRecord::Schema.define do create_table :users, force: true do |t| t.string :name, :email t.integer :topic_id t.timestamps null: false end create_table :topics, force: true do |t| t.string :title t.timestamps null: false end end attributes = { name: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', email: 'foobar@email.com' } class Topic < ActiveRecord::Base has_many :users end class User < ActiveRecord::Base belongs_to :topic end 100.times do User.create!(attributes) end users = User.first(50) Topic.create!(title: 'This is a topic', users: users) Benchmark.ips do |x| x.config(time: 10, warmup: 5) x.report("preload") do User.includes(:topic).all.to_a end end ``` Before ``` Calculating ------------------------------------- preload 26.000 i/100ms ------------------------------------------------- preload 265.347 (± 3.0%) i/s - 2.652k ``` After ``` Calculating ------------------------------------- preload 39.000 i/100ms ------------------------------------------------- preload 406.053 (± 1.7%) i/s - 4.095k ```
* | | | | mocha 1.3.0Akira Matsuda2017-09-252-3/+3
| | | | |
* | | | | Unneeded Mocha stubs for Kernel#systemAkira Matsuda2017-09-251-2/+0
| | | | | | | | | | | | | | | | | | | | It's done inside each test via assert_called_with or Kernel.expects
* | | | | Extract `integer_like_primary_key_type` to ease to handle it for adaptersRyuta Kamizono2017-09-254-17/+18
| | | | |
* | | | | Merge pull request #30615 from yhirano55/update_form_helpers_guideRyuta Kamizono2017-09-251-7/+11
|\ \ \ \ \ | | | | | | | | | | | | Update Form Helpers guide [ci skip]
| * | | | | Update Form Helpers guide to fix example codes [ci skip]Yoshiyuki Hirano2017-09-171-7/+11
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * It looks that example codes are not based on actual output. So I've fixed it. * Specifically: * There are no lines about utf-8 and authenticity_token. * The submit button doesn't have data-disabled-with attribute. * Each attribute order of html element is different from actual ones.
* | | | | Merge pull request #30698 from ↵Ryuta Kamizono2017-09-251-1/+0
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | bogdanvlviv/remove-unused-variables-from-release_rb Remove unused variable `gem_version` from `tasks/release.rb`
| * | | | | Remove unused variable `gem_version` from `tasks/release.rb`bogdanvlviv2017-09-241-1/+0
| | |_|_|/ | |/| | |
* | | | | Fix `test_should_sanitize_illegal_style_properties` failureRyuta Kamizono2017-09-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://travis-ci.org/rails/rails/jobs/279300966#L2600 The result of `Loofah::HTML5::Scrub.scrub_css` was changed since v2.1.0.rc1. https://github.com/flavorjones/loofah/commit/ca56295ff9e802018ea18d23ed49be235a95ccad