aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
Commit message (Collapse)AuthorAgeFilesLines
* fixed usage of Parameters when a non-numeric key existsL.Fexon2019-05-131-7/+17
| | | | | | | | | | test for non-numeric key in nested attributes test: extra blank line between tests removed test for non-numeric key fixed (by Daniel) Update according to feedback
* Revert "Include Caching module for ActionController::API"Rafael França2019-04-221-1/+0
|
* Make sure api controllers can perform caching as wellst00122019-04-191-0/+1
| | | | | | | | | | Currently ActionController::API doesn't include Caching module, so it can't perform caching. And even if users include it later manually, it won't inherit application's default cache store for action_controllers. So the only way to solve this issue is to include Caching module in ActionController::API, too. This closes #35602
* Remove unused modules from StrongParametersPatrik Bóna2019-04-151-4/+0
| | | | | | Unless I'm missing some undocumented use case, these modules aren't needed in `StrongParameters` anymore since 8e221127ab. Also, all actionpack tests are passing without them.
* Merge pull request #32541 from sergiogomez/remove-lock-from-params-wrapperMatthew Draper2019-04-121-1/+1
|\ | | | | Remove lock from method model
| * Remove lock from method modelSergio Gómez2018-04-121-1/+1
| |
* | Deduplicate strings held by the routerJean Boussier2019-04-031-1/+1
| |
* | Fix annotated typoPrathamesh Sonpatki2019-03-291-1/+1
| |
* | Suggest 'strict-origin' Referrer-Policy headerTom Richards2019-03-171-1/+1
| |
* | Update small typo in documentation.Kurt Mueller2019-03-121-1/+1
| |
* | Merge pull request #35121 from utilum/warning_tried_to_create_proc_without_blockKasper Timm Hansen2019-03-101-2/+2
|\ \ | | | | | | Ruby 2.7 warning: creating a Proc without a block
| * | ActionPack Proc.new without a blockutilum2019-02-131-2/+2
| | | | | | | | | | | | | | | | | | This commit fixes cases that use pre Ruby [r66772](https://bugs.ruby-lang.org/projects/ruby-trunk/repository/trunk/revisions/66772) syntax that are not tickled by the test suite.
* | | [ci skip] Fix typosShailesh Kalamkar2019-03-071-1/+1
| | |
* | | Merge pull request #35400 from aglushkov/stream_manual_cache_controlAaron Patterson2019-02-251-1/+1
|\ \ \ | | | | | | | | Allow custom cache-control header in AC::Live
| * | | Allow custom cache-control header in AC::LiveAndrey Glushkov2019-02-251-1/+1
| |/ / | | | | | | | | | https://github.com/rails/rails/issues/35312
* / / Pass the template format to the digestorAaron Patterson2019-02-151-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit passes the template format to the digestor in order to come up with a key. Before this commit, the digestor would depend on the side effect of the template renderer setting the rendered_format on the lookup context. I would like to remove that mutation, so I've changed this to pass the template format in to the digestor. I've introduced a new instance variable that will be alive during a template render. When the template is being rendered, it pushes the current template on to a stack, setting `@current_template` to the template currently being rendered. When the cache helper asks the digestor for a key, it uses the format of the template currently on the stack.
* | Tighten up the AV::Base constructorAaron Patterson2019-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AV::Base constructor was too complicated, and this commit tightens up the parameters it will take. At runtime, AV::Base is most commonly constructed here: https://github.com/rails/rails/blob/94d54fa4ab641a0ddeb173409cb41cc5becc02a9/actionview/lib/action_view/rendering.rb#L72-L74 This provides an AV::Renderer instance, a hash of assignments, and a controller instance. Since this is the common case for construction, we should remove logic from the constructor that handles other cases. This commit introduces special constructors for those other cases. Interestingly, most code paths that construct AV::Base "strangely" are tests.
* | Typo fixes action pack.alkesh262019-01-262-2/+2
| |
* | Merge pull request #35018 from gmcgibbon/revert_redirect_to_allow_other_hostRafael França2019-01-222-29/+7
|\ \ | | | | | | Revert ensure external redirects are explicitly allowed
| * | Revert ensure external redirects are explicitly allowedGannon McGibbon2019-01-222-29/+7
| | |
* | | Merge pull request #34952 from rails/template-stuffAaron Patterson2019-01-222-3/+3
|\ \ \ | |/ / |/| | Template Handler Refactoring
| * | Remove args from `default_render`Aaron Patterson2019-01-172-3/+3
| | | | | | | | | | | | It's always called with 0 params, so just remove the parameter
* | | Update the promisse that ActionController::TestCase will be extractedRafael Mendonça França2019-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We are past 5.1 and it was not extrated yet, so while we still have plans they will not be realized on 6.0, so it is better to not set expectations of which release will exclude it just yet. [ci skip]
* | | Ensure external redirects are explicitly allowedGannon McGibbon2019-01-173-17/+39
| | | | | | | | | | | | Add `fallback_location` and `allow_other_host` options to `redirect_to`.
* | | Document that `format.any` can match all formatsDaniel Schierbeck2019-01-161-0/+8
|/ / | | | | I had to dig around the code to discover this, since I had a use case for the behavior.
* | Capture parsing errors for ActionController::ParamsWrapper#process_actionHaroon Ahmed2019-01-081-16/+17
| |
* | Remove mention about `Test::Unit::TestCase` [ci skip]bogdanvlviv2019-01-021-3/+0
| | | | | | | | | | | | We've switched from `Test::Unit::TestCase` to `ActiveSupport::TestCase` since Rails 2.3. See https://edgeguides.rubyonrails.org/2_3_release_notes.html#other-railties-changes
* | Import Action MailboxGeorge Claghorn2018-12-251-12/+11
| |
* | Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-5/+3
| | | | | | | | | | | | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* | Use native `Array#append`, `Array#prepend`, `Hash#transform_keys`, and ↵Ryuta Kamizono2018-12-202-4/+0
| | | | | | | | | | | | | | | | | | | | `Hash#transform_keys!` Since Rails 6 requires Ruby 2.5. https://github.com/ruby/ruby/blob/ruby_2_5/NEWS Follow up #34754.
* | Allow nil params on controller HTTP test methodsr7kamura2018-12-181-2/+2
| |
* | colorize the unpermitted params log messageblahed2018-12-031-1/+1
| |
* | Allow rescue from parameter parse errorsGannon McGibbon2018-11-131-1/+4
| | | | | | | | [Gannon McGibbon + Josh Cheek]
* | Merge pull request #34314 from bf4/patch-2Gannon McGibbon2018-10-301-1/+1
|\ \ | | | | | | ActionController::API *does* support cookies, sessions
| * | ActionController::API *does* support cookies, sessionsBenjamin Fleischer2018-10-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | ActionController::Metal provides session support by delegating `session to the request (`"@_request"`) https://github.com/rails/rails/blob/a3dcba42e2422eb9c2e77011a39ce72dc934b420/actionpack/lib/action_controller/metal.rb#L149 Though the ActionController::Cookies modules isn't included, it's really a convenience for providing a first class `cookies` object. *all* ActionController::Metal subclasses support setting cookies via the `session` object.
* | | We don't want these internal methods as public methods in our controllersAkira Matsuda2018-10-301-23/+25
|/ / | | | | | | or they would be listed in `action_methods`
* | Fix `ActionController::Parameters#each_value` and add changelog entry to ↵Bogdan2018-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | this method (#34210) * Fix `ActionController::Parameters#each_value` `each_value` should yield with "value" of the params instead of "value" as an array. Related to #33979 * Add changelog entry about `ActionController::Parameters#each_value`. Follow up #33979
* | Add allocations to template renderer subscriptionEileen Uchitelle2018-10-101-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR adds the allocations to the instrumentation for template and partial rendering. Before: ``` Rendering posts/new.html.erb within layouts/application Rendered posts/_form.html.erb (9.7ms) Rendered posts/new.html.erb within layouts/application (10.9ms) Completed 200 OK in 902ms (Views: 890.8ms | ActiveRecord: 0.8ms) ``` After: ``` Rendering posts/new.html.erb within layouts/application Rendered posts/_form.html.erb (Duration: 7.1ms | Allocations: 6004) Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654) Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564) ```
* | Fix call sitesGannon McGibbon2018-10-021-1/+1
| |
* | Add `Style/RedundantFreeze` to remove redudant `.freeze`Yasuo Honda2018-09-296-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Rails 6.0 will support Ruby 2.4.1 or higher `# frozen_string_literal: true` magic comment is enough to make string object frozen. This magic comment is enabled by `Style/FrozenStringLiteralComment` cop. * Exclude these files not to auto correct false positive `Regexp#freeze` - 'actionpack/lib/action_dispatch/journey/router/utils.rb' - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333 Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed. * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required - 'actionpack/test/controller/test_case_test.rb' - 'activemodel/test/cases/type/string_test.rb' - 'activesupport/lib/active_support/core_ext/string/strip.rb' - 'activesupport/test/core_ext/string_ext_test.rb' - 'railties/test/generators/actions_test.rb'
* | Added ActionController::Parameters.each_value methodLukas Zapletal2018-09-271-0/+8
| |
* | Merge pull request #33829 from mtsmfm/encode-filenameKasper Timm Hansen2018-09-231-4/+3
|\ \ | | | | | | Encode Content-Disposition filenames on send_data and send_file
| * | Encode Content-Disposition filenames on send_data and send_fileFumiaki MATSUSHIMA2018-09-131-4/+3
| | |
* | | Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-234-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* | | Make sure the flash method is defined even if helpers are not presentRafael Mendonça França2018-09-131-5/+3
| | |
* | | Merge pull request #33569 from eric-hemasystems/conditional-flash-helperRafael França2018-09-131-3/+5
|\ \ \ | |/ / |/| | Conditionally use `helper_method` in Flash concern
| * | Conditionally use `helper_method` in Flash concernEric Anderson2018-08-091-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I was attempting to use the `flash` functionality in a `Metal` controller. When including the `flash` concern I received the following error: NoMethodError: undefined method `helper_method'.... Either: - `AbstractController::Helpers` should be a dependency of `ActionController::Flash` - `ActionController::Flash` should not require the existence of `AbstractController::Helpers`. Since my use case (set a flash and redirect) has no need for the helper method and that is a common use case, making the dependency conditional seemed the better option. NOTE: This is similar to issue #21067 only the error is within Rails itself while that issue had the error within Devise.
* | | Update documentation to ActionController::ConditionalGetAnatoly Mikhaylov2018-09-031-0/+6
| | | | | | | | | | | | Two implemented but undocumented features are to help indicate that cache is fresh for 3 hours, and it may continue to be served stale for up to an additional 60 seconds to parallel requests for the same resource or up to 5 minutes while errors are being returned back while the initial synchronous revalidation is attempted.
* | | Faster permitted_scalar_filterschneems2018-08-311-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running with code triage and derailed benchmarks and focusing on this file: Before 16199 /Users/rschneeman/Documents/projects/rails/actionpack/lib/action_controller/metal/strong_parameters.r After 2280 /Users/rschneeman/Documents/projects/rails/actionpack/lib/action_controller/metal/strong_parameters.rb
* | | [ci skip] Document permitted_scalar_filterschneems2018-08-301-0/+10
| | |