aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Make automatically synchronize test schema work inside engineyuuji.yaginuma2017-10-023-1/+36
| | | | | | | | | | | | | | | In Rails engine, migration files are in under `db/migrate` of engine. Therefore, when rake task is executed in engine, `db/migrate` is automatically added to `DatabaseTasks.migrations_paths`. https://github.com/rails/rails/blob/a18cf23a9cbcbeed61e8049442640c7153e0a8fb/activerecord/lib/active_record/railtie.rb#L39..L43 However, if execute the rake task under dummy app, migration files will not be loaded because engine's migration path setting process is not called. Therefore, in order to load migration files correctly, it is necessary to execute rake task under engine. Fixes #30765
* Merge pull request #30761 from patrickdavey/fix_broken_link_in_security_guideRyuta Kamizono2017-10-011-1/+1
|\ | | | | Fix broken link to recaptcha.net [ci skip]
| * Fix broken link to recaptcha.net [ci skip]Patrick Davey2017-10-011-1/+1
| | | | | | | | | | The link to recaptcha.net returns a 404. As far as I can tell, the new link ought to be to https://developers.google.com/recaptcha/ .
* | Ensure `AliasTracker` respects a custom table nameRyuta Kamizono2017-09-303-6/+10
| |
* | Remove `:api:` tag that has leaked on the doc directly [ci skip]Ryuta Kamizono2017-09-306-29/+4
| | | | | | | | | | | | | | | | | | | | | | | | Currently `:api:` tag has leaked on the doc directly since RDoc doesn't support `:api:` tag directive. http://api.rubyonrails.org/v5.1/classes/AbstractController/Rendering.html So `:api: private` doesn't work as expected. We are using `:nodoc:` for the purpose. Related #13989.
* | Merge pull request #30759 from y-yagi/remove_unused_methodsRyuta Kamizono2017-09-301-10/+0
|\ \ | | | | | | Remove unused methods from `RenderPartialWithRecordIdentificationController`
| * | Remove unused methods from `RenderPartialWithRecordIdentificationController`yuuji.yaginuma2017-09-301-10/+0
| | | | | | | | | | | | These methods no longer used since a3da293.
* | | Testing to ensure both bang and non-bang methods behaves consistentlyRyuta Kamizono2017-09-301-0/+23
| |/ |/| | | | | Follow up of #30728.
* | Merge pull request #30756 from ↵Ryuta Kamizono2017-09-301-1/+1
|\ \ | | | | | | | | | | | | y-yagi/dont_use_active_support_where_it_is_not_needed Don't use Active Support where it is not needed.
| * | Don't use Active Support where it is not needed.yuuji.yaginuma2017-09-301-1/+1
| |/ | | | | | | | | | | | | | | | | This code has been changed with https://github.com/rails/rails/pull/30735/files#diff-8e5f6b33c191ad6dec07f3288345a13fL47. However, `active_support/time` is not load automatically, so if use Action Pack alone, `days` method can not use and an error occurs. In this case, I think that there is no problem by specifying a value with Integer.
* | Merge pull request #30755 from y-yagi/fix_method_refined_warningRyuta Kamizono2017-09-301-2/+2
|\ \ | |/ |/| Fix "warning: method redefined; discarding old test_scaffold_plural_names"
| * Fix "warning: method redefined; discarding old test_scaffold_plural_names"yuuji.yaginuma2017-09-301-2/+2
|/ | | | | | | | | | | | Since warning was issued due to duplication of test names, fix the test name to a meaningful name. This fixes following warnings: ``` railties/test/generators/named_base_test.rb:141: warning: method redefined; discarding old test_scaffold_plural_names railties/test/generators/named_base_test.rb:62: warning: previous definition of test_scaffold_plural_names was here ```
* Fix `test "signed URL generation"` failureRyuta Kamizono2017-09-301-1/+1
| | | | https://travis-ci.org/rails/rails/jobs/281044755#L5582-L5586
* Fix "warning: `*' interpreted as argument prefix"Ryuta Kamizono2017-09-301-1/+1
|
* Merge pull request #30735 from tjschuck/fix_doc_code_formattingEileen M. Uchitelle2017-09-291-33/+38
|\ | | | | Fix formatting in ActionDispatch::SSL middleware docs
| * Fix formatting in ActionDispatch::SSL middleware docsT.J. Schuck2017-09-271-33/+38
| | | | | | | | | | | | | | Before: https://monosnap.com/file/J6xewF0tYpm6dC9nSTe82ddsHAOcM5.png After: https://monosnap.com/file/0tCYicLXNqRHAEMDb81u0aLb3gH9Wf.png [ci skip]
* | Merge pull request #30746 from conradbeach/masterVipul A M2017-09-291-1/+1
|\ \ | | | | | | Fix Typo in Testing Guide [ci skip]
| * | [ci skip] Fix typo.Conrad Beach2017-09-281-1/+1
|/ /
* | Preview PDFs and videosGeorge Claghorn2017-09-2836-68/+444
| |
* | Test for nil, people not likely to assign it false.Kasper Timm Hansen2017-09-281-2/+2
| |
* | Merge pull request #30709 from ↵Kasper Timm Hansen2017-09-282-3/+28
|\ \ | | | | | | | | | | | | mikeycgto/actiondispatch-use-aead-encrypted-cookies-patch Fixes for use_authenticated_cookie_encryption
| * | Fixes for use_authenticated_cookie_encryptionMichael Coyne2017-09-272-3/+28
| | | | | | | | | | | | Use CBC encryption is this configuration value is set to false
* | | Deprecate secret_token, long since usurped by secret_key_base.Kasper Timm Hansen2017-09-285-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See the changelog entry. Remove `secrets.secret_token` from the bug report templates, since we don't accept bug reports for Rails versions that don't support a `secret_key_base`. [ claudiob & Kasper Timm Hansen ]
* | | Merge pull request #30736 from ↵Ryuta Kamizono2017-09-281-1/+1
|\ \ \ | | | | | | | | | | | | | | | | bogdanvlviv/fix-activestorage-package_json_version_format Set version in activestorage/package.json in proper format.
| * | | Set version in activestorage/package.json in proper format.bogdanvlviv2017-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | `5.2.0.alpha` => `5.2.0-alpha` System versioning isn't compliant with npm.
* | | | Merge pull request #30695 from mikker/add-asserts-enqueued-emails-withGeorge Claghorn2017-09-273-0/+92
|\ \ \ \ | | | | | | | | | | Add assert_enqueued_email_with to ActionMailer::TestHelper
| * | | | Add assert_enqueued_email_with to ActionMailer::TestHelperMikkel Malmberg2017-09-273-0/+92
| | | | |
* | | | | 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 ```