Questions tagged [actiondispatch]

The ActionDispatch namespace module within the Ruby on Rails web framework.

80 questions
42
votes
5 answers

Rails 5.1: "unknown firstpos: NilClass" - Issue reloading application

Following an upgrade from Rails 5.0 to 5.1 I'm getting this error anytime the app reloads, either from code changes during rails server or if I call reload! from the console. 13:53$ rc Loading development environment (Rails 5.1.1) 2.3.1 :001 >…
JP Duffy
  • 1,231
  • 1
  • 11
  • 17
19
votes
5 answers

Test for HTTP status code in some RSpec rails request exampes, but for raised exception in others

In a Rails 4.2.0 application tested with rspec-rails, I provide a JSON web API with a REST-like resource with a mandatory attribute mand_attr. I'd like to test that this API answers with HTTP code 400 (BAD REQUEST) when that attribute is missing…
das-g
  • 8,581
  • 3
  • 33
  • 72
17
votes
2 answers

ActionDispatch::Routing::RouteSet#call Rails 4.1 really slow

I've searched for days but can't find any relevant answers to this question. In my Rails 4.1 app hosted on Heroku, when the load goes up, some PUT requests get REALLY slow. The slowest one today was 53 seconds. All without the database (MongoDB)…
16
votes
5 answers

Custom Error Handling with Rails 4.0

I'm building a Ruby on Rails api using Ruby 2.0 and Rails 4.0. My app is almost solely a JSON API, so if an error occurs (500, 404), I want to capture that error and return a nicely formatted JSON error message. I've tried this and also: rescue_from…
Ethan Mick
  • 9,257
  • 13
  • 54
  • 74
14
votes
2 answers

What is ActionDispatch?

I have a fairly decent grasp on the basic Rails concepts like ActiveRecord, routing, migrations, etc. One thing I'm having a hard time understanding is ActionDispatch. I can't find a plain-English description (or really any description) of what it…
Jason Swett
  • 38,405
  • 60
  • 193
  • 322
13
votes
2 answers

Rails 4.2 server; private and public ip not working

I recently updated my rails 4.1.8 to 4.2 I'm not able to access rails app using private ip 192.168.1.x:3000 and also with my public-ip address. Rails app is working with lvh.me:3000, 0.0.0.0:3000, localhost:3000 and 127.0.0.1:3000. But it looks all…
Ashwin Yaprala
  • 2,497
  • 2
  • 22
  • 50
10
votes
4 answers

Rails: Filter sensitive data in JSON parameter from logs

I am running Rails 3 and trying to filter sensitive information out of our logs which are JSON blobs that are passed as post parameters. For example, user creation might take a post param called user with a string value that is a JSON object. One of…
thefugal
  • 1,204
  • 10
  • 18
10
votes
3 answers

Get constraint based url using url_for based on mounted engine

Is there any way that i can make url_for to return the url based on the request.host during action dispatch routing ? mount Collaborate::Engine => '/apps/collaborate', :constraints => {:host => 'example.com' } mount Collaborate::Engine =>…
Vivek Sampara
  • 387
  • 3
  • 20
8
votes
3 answers

Overriding params in nested routes

I want to have consistency in naming convention of my routes. Default param is :id for any resource. However if one nests another resource in it, param of parent resource changes to :parent_id. My routing looks like: resources :users do resources…
sonalkr132
  • 869
  • 1
  • 9
  • 21
7
votes
2 answers

Rails, how do you access the raw request data at the absolute lowest level?

When is the Rails request object available at the earliest time during the request lifecycle? Essentially, when is the request first available as a request object, and in which object? ActionDispatch? Can you access request parameters from…
scottkf
  • 175
  • 3
  • 9
6
votes
2 answers

How to filter nested parameters from Rails logs

I see that I can filter keys from Rails logs here, but it's not entirely clear how I can filter a key that is nested inside the parameter hash. My params hash looks like this: {"download"=>{"attachment_id"=>"54039",…
mehulkar
  • 4,624
  • 4
  • 30
  • 50
5
votes
1 answer

Rails: ParameterFilter::compiled_filter tries to dup symbol

I'm running rails3 with rails exception-notifier gem. When an exception occurs, and an email should be sent, I'm getting an exception from the ParameterFilter class. I've found the problem in the rails source, and am not sure the best way to…
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,586
  • 4
  • 44
  • 58
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
  • 39,557
  • 59
  • 208
  • 346
4
votes
2 answers

Configuring Rails App to handle multiple subdomains and multiple cookies

I have a rails app which supports multiple domains and each domain may have multiple subdomains. Users visiting mydomain1.com do not receive the same experience as mydomain2.com (although the base behaviour of the apps is the same) Therefore, if a…
1
2 3 4 5 6