The ActionDispatch
namespace module within the Ruby on Rails web framework.
Questions tagged [actiondispatch]
84 questions
4
votes
1 answer
how does a middleware get deleted?
rack-timeout is included in the Gemfile, but we only want it as middleware on production. Thus in an initializer, we have:
config.middleware.delete Rack::Timeout
Inspecting before and after this line shows rack-timeout removed from the array. …

Peter Ehrlich
- 6,969
- 4
- 49
- 65
4
votes
0 answers
How do you set a signed cookie in a Rails integration test?
How do you set a signed cookie within a Rails integration test?
For example, assuming I load the :user_id from the cookie, this is the way I would expect to test it, but no joy:
test "success when cookie properly set" do
…

Tom Rossi
- 11,604
- 5
- 65
- 96
4
votes
2 answers
How do you use ActionDispatch::Routing::RouteSet recognize_path?
How do you use ActionDispatch::Routing::RouteSet recognize_path?
I want to get the current path for the view.
I tried
but got "undefined method `recognize_path' for…

B Seven
- 44,484
- 66
- 240
- 385
4
votes
1 answer
ActionDispatch::ParamsParser replacement after upgrade to Rails 5
Migrating an app from Rails 4.2.9 to 5.2.1.
This is latest issue:
$ rails console
/Users/meltemi/rails/myapp/config/initializers/disable_xml_params.rb:3:in `': uninitialized constant ActionDispatch::ParamsParser (NameError)
from…

Meltemi
- 37,979
- 50
- 195
- 293
4
votes
1 answer
Remove the HTTP_ prefix in Rails headers
Any request sent to a Rails controller gets an HTTP_ prefixed to it, as that's appended by ActionDispatch::HTTP.Headers. Is there a way to prevent that (without overriding ActionDispatch::HTTP, so that I can use my custom headers, as is and use…

absessive
- 1,121
- 5
- 14
- 36
3
votes
0 answers
Can the Rails CSP middleware support having both a Content-Security-Policy and Content-Security-Policy-Report-Only header in same response?
I'm hoping to implement a Content-Security-Policy in my application and iterate on the policy by adding rules to a Content-Security-Policy-Report-Only header so I can maintain the existing security while testing new policies in my production…

rpassza
- 226
- 1
- 2
- 8
3
votes
3 answers
ActionDispatch::ClosedError when testing Rails 3.1 model creation (RSpec/Cucumber)
I am creating a web application with Ruby on Rails 3.1 (RC1). I am using Factory Girl, RSpec and Cucumber (with Capybara) for testing, but I am experiencing unexpected raised ActionDispatch::ClosedErrors some of the times (not every time) when I am…

sindrenm
- 3,254
- 3
- 24
- 30
3
votes
1 answer
What is the and why is there a difference between request.env['CONTENT_TYPE'] and request.content_type?
I'm seeing two different values for request.env['CONTENT_TYPE'] and request.content_type.
From a separate application, I am sending a request to my Rails application and have explicitly set the Content-Type to text/xml.
Here is what I am seeing on…

John
- 9,254
- 12
- 54
- 75
3
votes
1 answer
Restrict length of log output in Rails
I have an API that accepts base64 encoded images. The requests come in looking like:
{
image: "ijt41ig8ahbha8oij4j1tjletc"
}
The base64 encoded strings can be very large, sometimes 10k - 100k characters. When a request is sent with improperly…

mccalljt
- 786
- 3
- 14
3
votes
2 answers
Overriding Named Route Parameters with nested resources
I want to override the :id param and this explains how. But doesn't really work with nested resources.
My routes look like:
resources :users, param: :user_id do
resources :projects, param: :project_id
end
this generates url of format:…

sonalkr132
- 967
- 1
- 9
- 25
3
votes
1 answer
undefined method `propfind' for ActionDispatch::Routing::Mapper
I am trying to implement git push on my rails app and it sends PROPFIND request which rails doesn't seem to validate. When I try:
git push http://localhost:3000/satellite/.git
it gives me:
Started PROPFIND "/satellite/.git/" for 127.0.0.1 at…

sonalkr132
- 967
- 1
- 9
- 25
2
votes
0 answers
How to write a base setup and teardown that runs before every ActionDispatch::IntegrationTest
I have a number of integration tests written using ActionDispatch::IntegrationTest for a Rails 4 app. I'm trying to add a few lines to every setup and teardown which I want to get called before each test runs, without overriding the setup and…

DaniG2k
- 4,772
- 36
- 77
2
votes
1 answer
Failing rails test - ActionController::UnknownFormat:
I'm currently writing tests for all my controllers and have run into an issue I cannot solve. For one of my controllers, every test works (show, index, new, edit, update) but for some reason my #create test cannot pass. Just to clarify: all the…

rock_n_rolla
- 337
- 4
- 13
2
votes
1 answer
Rail 5 swap ActionDispatch::Reloader with a custom reloader
We have a use case for mounting a mock engine to process sessions when developing locally in which a custom session middleware calls the mock engine via Net::http request when a request comes through.
When there is code change, the reloader is…

AirWick219
- 894
- 8
- 27