aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #32130 from benoittgt/rake-routes-compact-modeRafael França2018-02-283-40/+158
|\ | | | | Add "rails routes --expanded" mode
| * Add --expanded option to "rails routes"Benoit Tigeot2018-02-283-40/+158
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using rails routes with small terminal or complicated routes it can be very difficult to understand where is the element listed in header. psql had the same issue, that's why they created "expanded mode" you can switch using `\x` or by starting psql with ``` -x --expanded Turn on the expanded table formatting mode. This is equivalent to the \x command. ``` The output is similar to one implemented here for rails routes: db_user-# \du List of roles -[ RECORD 1 ]---------------------------------------------- Role name | super Attributes | Superuser, Create role, Create DB Member of | {} -[ RECORD 2 ]---------------------------------------------- Role name | role Attributes | Superuser, Create role, Create DB, Replication Member of | {}
* | Remove CHANGELOG entries which were backported to 5-2-stableRyuta Kamizono2018-02-281-5/+0
|/
* Uses the absolute path for system test screenshotsZamith2018-02-272-6/+6
| | | | | | | | | | | | | Why: * When getting an error that generates a screenshot it would be helpful to be able to ctrl+click it to quickly open it in the browser, which does not work with relative paths This change addresses the need by: * Changing `image_path` to disregard the relative path and use the absolute one instead
* Merge pull request #31720 from grantbdev/update_default_hsts_max_ageGuillermo Iguaran2018-02-242-7/+6
|\ | | | | Update default HSTS max-age value to 1 year
| * Merge branch 'master' into update_default_hsts_max_ageGuillermo Iguaran2018-02-2462-570/+470
| |\
| * | Update default HSTS max-age value to 1 yearGrant Bourque2018-01-163-7/+11
| | | | | | | | | | | | | | | - Update the default HSTS max-age value to 31536000 seconds (1 year) to meet the minimum max-age requirement for https://hstspreload.org/.
* | | Support for automatic nonce generation was backported to 5.2Guillermo Iguaran2018-02-241-28/+0
| |/ |/|
* | Merge pull request #32018 from rails/add-nonce-support-to-cspAndrew White2018-02-224-0/+94
|\ \ | | | | | | Add support for automatic nonce generation for Rails UJS
| * | Add support for automatic nonce generation for Rails UJSAndrew White2018-02-194-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the UJS library creates a script tag to process responses it normally requires the script-src attribute of the content security policy to include 'unsafe-inline'. To work around this we generate a per-request nonce value that is embedded in a meta tag in a similar fashion to how CSRF protection embeds its token in a meta tag. The UJS library can then read the nonce value and set it on the dynamically generated script tag to enable it to execute without needing 'unsafe-inline' enabled. Nonce generation isn't 100% safe - if your script tag is including user generated content in someway then it may be possible to exploit an XSS vulnerability which can take advantage of the nonce. It is however an improvement on a blanket permission for inline scripts. It is also possible to use the nonce within your own script tags by using `nonce: true` to set the nonce value on the tag, e.g <%= javascript_tag nonce: true do %> alert('Hello, World!'); <% end %> Fixes #31689.
* | | We should call methods with `.method_name` not `::method_name`.utilum2018-02-222-5/+6
| | | | | | | | | | | | | | | | | | Found several instances. Follow up on 63d530c5e68a8cf53603744789f53ccbc7ac1a0e
* | | Merge pull request #32032 from utilum/method_redefinedAndrew White2018-02-191-2/+2
|\ \ \ | |/ / |/| | Avoid method_redefined warnings in RouteSet::NamedRouteCollection
| * | Avoid method_redefined warnings in RouteSet::NamedRouteCollectionutilum2018-02-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` ~/.rbenv/versions/2.5.0/bin/ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/routing_test.rb Run options: --seed 5851 .......~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ....~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ..........~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ..... Finished in 13.233638s, 1.9647 runs/s, 5.8185 assertions/s. 26 runs, 77 assertions, 0 failures, 0 errors, 0 skips ``` After: ``` ~/.rbenv/versions/2.5.0/bin/ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/routing_test.rb Run options: --seed 38072 .......................... Finished in 12.009632s, 2.1649 runs/s, 6.4115 assertions/s. 26 runs, 77 assertions, 0 failures, 0 errors, 0 skips ```
* | | Remove trailing semi-colon from CSPAndrew White2018-02-192-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | Although the spec[1] is defined in such a way that a trailing semi-colon is valid it also doesn't allow a semi-colon by itself to indicate an empty policy. Therefore it's easier (and valid) just to omit it rather than to detect whether the policy is empty or not. [1]: https://www.w3.org/TR/CSP2/#policy-syntax
* | | Revert "Merge pull request #32045 from eagletmt/skip-csp-header"Andrew White2018-02-192-30/+4
|/ / | | | | | | | | | | | | | | | | This reverts commit 86f7c269073a3a9e6ddec9b957deaa2716f2627d, reversing changes made to 5ece2e4a4459065b5efd976aebd209bbf0cab89b. If a policy is set then we should generate it even if it's empty. However what is happening is that we're accidentally generating an empty policy when the initializer is commented out by default.
* | Skip generating empty CSP header when no policy is configuredKohei Suzuki2018-02-182-4/+30
| | | | | | | | | | | | | | | | `Rails.application.config.content_security_policy` is configured with no policies by default. In this case, Content-Security-Policy header should not be generated instead of generating the header with no directives. Firefox also warns "Content Security Policy: Couldn't process unknown directive ''".
* | Rails 6 requires Ruby 2.4.1+Jeremy Daer2018-02-175-4/+7
| | | | | | | | | | | | Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug. References #32028
* | Clean up and consolidate .gitignoresbogdanvlviv2018-02-171-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Global ignores at toplevel .gitignore * Component-specific ignores in each toplevel directory * Remove `actionview/test/tmp/.keep` for JRuby ``` rm actionview/test/tmp/ -fr cd actionview/ bundle exec jruby -Itest test/template/digestor_test.rb ``` Related to #11743, #30392. Closes #29978.
* | Partly revert 1e526788e6b1d3f42f4d8fdca20e588d42838c80bogdanvlviv2018-02-171-1/+4
| | | | | | | | | | | | Some attr_readers should be `protected` instead of `private` See https://travis-ci.org/rails/rails/builds/342800276
* | Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-172-22/+10
| |
* | Fix array routing constraintsfatkodima2018-02-172-4/+7
| |
* | Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-164-11/+8
| | | | | | | | | | Some places we can't remove because Ruby still don't have a method equivalent to strip_heredoc to be called in an already existent string.
* | Write the code in a more natural way.Rafael Mendonça França2018-02-161-2/+2
| |
* | Remove support to Ruby 2.2Rafael Mendonça França2018-02-161-1/+1
| | | | | | | | Rails 6 will only support Ruby >= 2.3.
* | PERF: reduce retained objects in JourneySam2018-02-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: Total allocated: 209050523 bytes (2219202 objects) Total retained: 36580305 bytes (323462 objects) After: Total allocated: 209180253 bytes (2222455 objects) Total retained: 36515599 bytes (321850 objects) --- Modest saving of 1612 RVALUEs in the heap on Discourse boot The larger the route file the better the results. Saving will only be visible on Ruby 2.5 and up.
* | correct the dedup codeSam2018-02-151-3/+3
| |
* | Revert "Revert "Merge pull request #31999 from SamSaffron/patch-1""Rafael Mendonça França2018-02-151-4/+11
| | | | | | | | This reverts commit f282f3758d31e8445d0854e2ae7a67f17cede3bc.
* | Revert "Merge pull request #31999 from SamSaffron/patch-1"Rafael Mendonça França2018-02-151-11/+4
| | | | | | | | | | | | | | This reverts commit 9f65d2a08bc80a94bbb2c0b6e00957c7059aed25, reversing changes made to 966843732a607864b077b72b2a17168d4e3548cc. This broken a lot of tests.
* | PERF: dedupe scanned route fragmentsSam2018-02-151-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per: https://bugs.ruby-lang.org/issues/13077 String @- will dedupe strings. This takes advantage of this by deduping route fragments that are full of duplication usually. For Discourse: Before: Total allocated: 207574305 bytes (2214916 objects) Total retained: 36470010 bytes (322194 objects) After Total allocated: 207556847 bytes (2214711 objects) Total retained: 36327973 bytes (318627 objects) <- object that GC can not collect So we save 3500 or so RVALUES this way, not the largest saving in the world, but worth it especially for large route files.
* | Unused core_extAkira Matsuda2018-02-111-1/+0
| |
* | Make sure assert_recognizes can still find routes mounted after enginesRafael Mendonça França2018-02-092-4/+12
| | | | | | | | | | Before, if the application defined after an engine this method would not recognize the route since it was not defined insdie the engine.
* | Add changelog entry for #31844bogdanvlviv2018-02-011-0/+4
| |
* | Consistent behavior for session and cookies with to_h and to_hash methodIgor Kasyanchuk2018-01-314-0/+11
| |
* | Start Rails 6.0 development!!!Rafael Mendonça França2018-01-302-248/+4
| | | | | | | | :tada::tada::tada:
* | Merge pull request #31815 from composerinteralia/make-request-idGeorge Claghorn2018-01-292-1/+6
|\ \ | | | | | | Allow @ in X-Request-Id header
| * | Allow @ in X-Request-Id headerDaniel Colson2018-01-292-1/+6
| | | | | | | | | | | | | | | | | | | | | It makes sense to be as strict as possible with headers from the outside world, but allowing @ to support Apache's mod_unique_id (see #31644) seems OK to me
* | | ActionController::TestCase: fix #post documentation [ci skip]Misty De Meo2018-01-291-1/+1
|/ / | | | | | | Fixes #31823.
* | Use assert_empty and assert_not_emptyDaniel Colson2018-01-259-17/+17
| |
* | Use assert_predicate and assert_not_predicateDaniel Colson2018-01-2526-174/+174
| |
* | Change refute to assert_notDaniel Colson2018-01-253-12/+12
| |
* | Use respond_to test helpersDaniel Colson2018-01-257-9/+9
| |
* | Remove code duplication for `ActionController::Metal.action`fatkodima2018-01-221-10/+8
| |
* | Fix typos. Improve text_helper documentation.James Lovejoy2018-01-191-3/+3
| | | | | | | | [ci skip]
* | Merge pull request #31732 from ↵Matthew Draper2018-01-191-1/+1
|\ \ | | | | | | | | | | | | koic/enable_autocorrect_for_lint_end_alignment_cop Enable autocorrect for `Lint/EndAlignment` cop
| * | Enable autocorrect for `Lint/EndAlignment` copKoichi ITO2018-01-181-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary This PR changes .rubocop.yml. Regarding the code using `if ... else ... end`, I think the coding style that Rails expects is as follows. ```ruby var = if cond a else b end ``` However, the current .rubocop.yml setting does not offense for the following code. ```ruby var = if cond a else b end ``` I think that the above code expects offense to be warned. Moreover, the layout by autocorrect is unnatural. ```ruby var = if cond a else b end ``` This PR adds a setting to .rubocop.yml to make an offense warning and autocorrect as expected by the coding style. And this change also fixes `case ... when ... end` together. Also this PR itself is an example that arranges the layout using `rubocop -a`. ### Other Information Autocorrect of `Lint/EndAlignment` cop is `false` by default. https://github.com/bbatsov/rubocop/blob/v0.51.0/config/default.yml#L1443 This PR changes this value to `true`. Also this PR has changed it together as it is necessary to enable `Layout/ElseAlignment` cop to make this behavior.
* | Merge pull request #31713 from aellispierce/refactor-browser-optionsEileen M. Uchitelle2018-01-174-29/+57
|\ \ | |/ |/| Move browser config to its own class
| * Move browser checking to its own classAshley Ellis Pierce2018-01-154-29/+57
| |
* | Fix typos, update documentationJames Lovejoy2018-01-111-2/+2
| | | | | | | | [ci skip]
* | Merge pull request #31534 from claudiob/kaspth-approachKasper Timm Hansen2018-01-093-0/+35
|\ \ | | | | | | Don't include Active Storage migrations in new apps
| * | Help if Active Storage tables are missingClaudio B2017-12-213-0/+35
| |/ | | | | | | | | | | When a user tries to create a new attachment or blog and the matching table is missing from the database (`active_storage_attachments` and `active_storage_blobs` by default), an informative error is displayed that invites users to run the `active_storage:install` task.