aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | | | | | Fix rails guides generationlocalhostdotdev2019-03-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Was getting `formats=': Invalid formats: "html"
* | | | | | | | | | | Merge pull request #35705 from alimi/instrumenter-block-optionalEileen M. Uchitelle2019-03-224-4/+29
|\ \ \ \ \ \ \ \ \ \ \ | |_|/ / / / / / / / / |/| | | | | | | | | | Update AS::Notifications::Instrumenter#instrument
| * | | | | | | | | | Update instrumentation guides w/optional blockAli Ibrahim2019-03-221-0/+11
| | | | | | | | | | |
| * | | | | | | | | | Update CHANGELOG and docsAli Ibrahim2019-03-222-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with change to ActiveSupport::Notifications::Instrumenter#instrument
| * | | | | | | | | | Update AS::Notifications::Instrumenter#instrumentAli Ibrahim2019-03-222-1/+7
|/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update #instrument to make passing a block optional. This will let users leverage #instrument for messaging in addition to instrumentation.
* | | | | | | | | | Merge pull request #35617 from mattyoho/add-annotation-support-to-relationsEileen M. Uchitelle2019-03-2238-19/+645
|\ \ \ \ \ \ \ \ \ \ | |_|_|_|_|/ / / / / |/| | | | | | | | | Add support for annotating queries generated by ActiveRecord::Relation with SQL comments
| * | | | | | | | | Add Relation#annotate for SQL commentingMatt Yoho2019-03-2138-19/+645
| | |_|_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has two main portions: 1. Add SQL comment support to Arel via Arel::Nodes::Comment. 2. Implement a Relation#annotate method on top of that. == Adding SQL comment support Adds a new Arel::Nodes::Comment node that represents an optional SQL comment and teachers the relevant visitors how to handle it. Comment nodes may be added to the basic CRUD statement nodes and set through any of the four (Select|Insert|Update|Delete)Manager objects. For example: manager = Arel::UpdateManager.new manager.table table manager.comment("annotation") manager.to_sql # UPDATE "users" /* annotation */ This new node type will be used by ActiveRecord::Relation to enable query annotation via SQL comments. == Implementing the Relation#annotate method Implements `ActiveRecord::Relation#annotate`, which accepts a comment string that will be appeneded to any queries generated by the relation. Some examples: relation = Post.where(id: 123).annotate("metadata string") relation.first # SELECT "posts".* FROM "posts" WHERE "posts"."id" = 123 # LIMIT 1 /* metadata string */ class Tag < ActiveRecord::Base scope :foo_annotated, -> { annotate("foo") } end Tag.foo_annotated.annotate("bar").first # SELECT "tags".* FROM "tags" LIMIT 1 /* foo */ /* bar */ Also wires up the plumbing so this works with `#update_all` and `#delete_all` as well. This feature is useful for instrumentation and general analysis of queries generated at runtime.
* | | | | | | | | Merge pull request #35695 from jhawthorn/render_templateRafael França2019-03-227-42/+43
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Prefer render template: over render file: in tests
| * | | | | | | | | Prefer render template: in testsJohn Hawthorn2019-03-217-42/+43
| | |_|_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many tests were using `render file:`, but were only testing the behaviour of `render template:` (file: just allows more paths/ is less secure then template:). The reason for so many `render file:` is probably that they were the old default. This commit replaces `render file:` with `render template:` anywhere the test wasn't specifically interested in using `render file:`.
* | | | | | | | | Fix announce scriptRafael Mendonça França2019-03-221-2/+5
| | | | | | | | |
* | | | | | | | | Fix release templateRafael Mendonça França2019-03-211-2/+2
| |/ / / / / / / |/| | | | | | |
* | | | | | | | Fix server restart test on Puma 3.12.1yuuji.yaginuma2019-03-222-4/+4
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since https://github.com/puma/puma/pull/1700, the default host is correctly used. So `localhost` is used instead of `0.0.0.0`. As a result, the log output on restart is changed, and the restart test fails on Puma 3.12.1. https://travis-ci.org/rails/rails/jobs/509239592#L2303-L2305 Specify binding explicitly to avoid being affected by Puma changes.
* | | | | | | Fix document formatting of Database configuration classes [ci skip]yuuji.yaginuma2019-03-213-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Show options as list. * Fix incorrect quoting.
* | | | | | | Address rubocop offencesRyuta Kamizono2019-03-212-9/+9
| | | | | | |
* | | | | | | Merge pull request #35685 from XrXr/attribute-forwardingGannon McGibbon2019-03-202-0/+24
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | Document option forwarding in ActiveRecord::Base.attribute
| * | | | | | Document option forwarding in ActiveRecord::Base.attributeAlan Wu2019-03-202-0/+24
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | This has been supported for a while but we didn't have documentation for it.
* | | | | | Merge pull request #35546 from rails/bulk-inserts-with-indexKasper Timm Hansen2019-03-203-139/+165
|\ \ \ \ \ \ | | | | | | | | | | | | | | Bulk Insert: Reuse indexes for unique_by
| * | | | | | [ci skip] Documentation pass for insert_all etc.Kasper Timm Hansen2019-03-201-105/+107
| | | | | | |
| * | | | | | Bulk Insert: Reuse indexes for unique_byKasper Timm Hansen2019-03-203-64/+88
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I found `:unique_by` with `:columns` and `:where` inside it tough to grasp. The documentation only mentioned indexes and partial indexes. So why duplicate a model's indexes in an insert_all/upsert_all call when we can just look it up? This has the added benefit of raising if no index is found, such that people can't insert thousands of records without relying on an index of some form.
* | | | | | Merge pull request #35661 from jhawthorn/lookup_context_validationEileen M. Uchitelle2019-03-204-3/+19
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Validate types assigned to LookupContext#formats=
| * | | | | Don't compact formatsJohn Hawthorn2019-03-192-6/+1
| | | | | |
| * | | | | Avoid assigning [nil] to formatsJohn Hawthorn2019-03-191-1/+1
| | | | | |
| * | | | | Improve "raises on invalid format assignment" testJohn Hawthorn2019-03-181-2/+2
| | | | | |
| * | | | | Rename invalid_types to invalid_valuesJohn Hawthorn2019-03-181-3/+3
| | | | | |
| * | | | | Use symbol for mail preview format, not stringJohn Hawthorn2019-03-181-1/+1
| | | | | |
| * | | | | Raise in LookupContext#formats= on invalid formatJohn Hawthorn2019-03-182-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a developer quality of life improvement, to ensure that unknown formats aren't assigned (which it would previously accept, but wouldn't work 100% correctly due to caching).
| * | | | | Make uniq in LookupContext#formats=John Hawthorn2019-03-182-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having a format listed twice had no effect. This is mostly helpful to avoid an extra format when assigning [:html, "*/*"]
| * | | | | Ignore nil in LookupContext#formats=John Hawthorn2019-03-182-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also removes the mutation we were performing on the values being passed in.
* | | | | | Merge pull request #35677 from ↵Kasper Timm Hansen2019-03-201-1/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | bogdanvlviv/mention-process_middleware.action_dispatch-in-the-guide Add mention about `process_middleware.action_dispatch` in the guide [ci skip]
| * | | | | | Add mention about `process_middleware.action_dispatch` in the guide [ci skip]bogdanvlviv2019-03-201-1/+10
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | We added ActiveSupport::Notifications instrumentation of the processing of each middleware in the stack, See 04ae0b0b5e594e0bb99c5cd608921745977bcdcd.
* | | | | | Merge pull request #35679 from y-yagi/make_aliases_of_database_option_workYuji Yaginuma2019-03-205-2/+32
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Make aliases of `database` option in generators work
| * | | | | Make aliases of `database` option in generators workyuuji.yaginuma2019-03-205-2/+32
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thor automatically adds `-` if aliases do not start with `-`. https://github.com/erikhuda/thor/blob/0879c1773d188902d54f95174f33961ac33111f8/lib/thor/parser/options.rb#L53 But Thor follows a convention of one-dash-one-letter options. So, even if `-` is added to `db`, it does not work. https://github.com/erikhuda/thor/blob/0879c1773d188902d54f95174f33961ac33111f8/lib/thor/parser/options.rb#L4 Follow up #34021.
* | | | | Merge pull request #35649 from andrehjr/fix-override-of-cookies-controller-specsRafael França2019-03-192-1/+14
|\ \ \ \ \ | | | | | | | | | | | | Don't override @set_cookies on CookieJar#update_cookies_from_jar'
| * | | | | Don't override @set_cookies on CookieJar#update_cookies_from_jar'André Luis Leal Cardoso Junior2019-03-172-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building the cookie_jar for the current test request. It was possible for this method to override keys currently being set on the test itself. In situations such as when making two requests mixing creating the cookie on the test and the controller.
* | | | | | Merge pull request #35595 from ↵Rafael França2019-03-192-4/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | shioyama/generated_attribute_methods_namespaced_constant Give GeneratedAttributeMethods module a name
| * | | | | | Give GeneratedAttributeMethods module a nameChris Salzberg2019-03-132-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently GeneratedAttributeMethods is a module builder class, an instance of which is included in every AR class. OTOH, GeneratedAssociatedMethods is assigned to a constant under the model namespace. This is inconsistent and looks strange in the list of ancestors. There is no particular reason *not* to assign a constant for this (very important) module under the model namespace, so that's what this commit does. Previous to this change, ancestors for an AR class looked like this: ``` => [User (call 'User.connection' to establish a connection), User::GeneratedAssociationMethods, #<ActiveRecord::AttributeMethods::GeneratedAttributeMethods:0x000055ace0f05b08>, ApplicationRecord(abstract), ApplicationRecord::GeneratedAssociationMethods, #<ActiveRecord::AttributeMethods::GeneratedAttributeMethods:0x000055ace093c460>, ActiveRecord::Base, ... ``` With this change, they look like this: ``` => [User (call 'User.connection' to establish a connection), User::GeneratedAssociationMethods, User::GeneratedAttributeMethods, ApplicationRecord(abstract), ApplicationRecord::GeneratedAssociationMethods, ApplicationRecord::GeneratedAttributeMethods, ActiveRecord::Base, ... ``` The previously named `GeneratedAttributeMethods` module builder class is renamed `GeneratedAttributeMethodsBuilder` to emphasize that this is not a module but a class.
* | | | | | | Merge pull request #35675 from ↵Rafael França2019-03-192-4/+0
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | larouxn/revert-35656-revert-34277-remove-javascripts-javascripts_engine-options-for-generators Revert "Revert "Remove `javascripts` and `javascript_engine` options for generators""
| * | | | | | | Revert "Revert "Remove `javascripts` and `javascript_engine` options for ↵Nicholas La Roux2019-03-202-4/+0
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | generators""
* | | | | | | Fix test broken by 04ae0b0b5e594e0bb99c5cd608921745977bcdcdRafael Mendonça França2019-03-191-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test was trying to set the exception_app in the wrapper proxy instead in the middleware itself.
* | | | | | | Merge pull request #35670 from jhawthorn/re_add_template_updated_atRafael França2019-03-192-6/+13
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Re-add Template#updated_at as deprecated
| * | | | | | | Re-add Template#updated_at as deprecatedJohn Hawthorn2019-03-192-6/+13
|/ / / / / / /
* | | | | | | Merge pull request #35656 from ↵Rafael França2019-03-192-0/+4
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | larouxn/revert-34277-remove-javascripts-javascripts_engine-options-for-generators Revert "Remove `javascripts` and `javascript_engine` options for generators"
| * | | | | | | Revert "Remove `javascripts` and `javascript_engine` options for generators"Nicholas La Roux2019-03-192-0/+4
| | | | | | | |
* | | | | | | | Merge pull request #35664 from jeremyevans/remove-roflscalingRafael França2019-03-193-85/+26
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Remove roflscaling
| * | | | | | | | Remove roflscaling constantsJeremy Evans2019-03-192-15/+0
| | | | | | | | |
| * | | | | | | | Remove roflscalingJeremy Evans2019-03-183-70/+26
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | roflscaling (using frozen string constants instead of literal strings) was added in 2012, before frozen string literals were added in Ruby 2.3. Now that Rails no longer supports Ruby <2.3, and all of these files use frozen string literals, there is no reason to keep the roflscaling. This does not delete or deprecate the related constants. Such a change can be made in a later commit.
* | | | | | | | Merge pull request #35662 from jhawthorn/fallback_resolver_no_virtual_pathAaron Patterson2019-03-192-8/+32
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Remove virtual_path from fallback templates
| * | | | | | | | Remove virtual_path from fallback templatesJohn Hawthorn2019-03-182-8/+32
| |/ / / / / / /
* | | | | | | | Merge pull request #35660 from kamipo/sanitize_as_sql_commentRyuta Kamizono2019-03-205-8/+15
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Extract `sanitize_as_sql_comment` from SQL visitor into connection
| * | | | | | | | Extract `sanitize_as_sql_comment` from SQL visitor into connectionRyuta Kamizono2019-03-195-8/+15
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Probably that is useful for any other feature as well.