Questions tagged [actiondispatch]

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

84 questions
0
votes
2 answers

Rails - how to access ActionDispatch UploadedFile default attributes in my methods?

I'm new to rails and building a simple bank statement converter app. User would select bank name, upload their statement, click "convert", and the converted file will be automatically downloaded. How to access Rails…
Mike S
  • 151
  • 1
  • 8
0
votes
1 answer

Override method/variable in a gem rails

I am trying to find a way to override a variable in a rails gem actionpack/http/parameters.rb. I have to process an ndjson stream and the rails middleware cannot process ndjson. It uses ActiveSupport::JSON.decode This is the source of the code…
Ndeto
  • 315
  • 6
  • 17
0
votes
1 answer

the initialstate for use reducer isn't updating while using context api in react js

I am fairly new at using context API and hooks in react. am facing a problem that the initial state is not updating while trying to pass a dispatch of action using a reference of useReducer, eventhought the objects are passed to it. The code are as…
0
votes
1 answer

Redux-Saga: Saga does not work sometimes on action dispatch

I am dispatching an action to upload videos. The action is supposed to run the saga but it does not work as expected. Sometimes the saga runs, sometimes it doesn't. I don't know where exactly is the case the saga won't listen to the action. The…
0
votes
0 answers

Stack level too deep on upgrading rails 3.1.10 to 3.2.0

I am getting the following errors after upgrading my rails application from 3.1.10 to 3.2.0. rails console is opening fine. And, I am able to execute code in console. However, When I run rails server and open page in browser. It fails and shows the…
0
votes
1 answer

ActionController::UnknownFormat on rails tests when passing json to controller

I am writing some tests for one of my controllers, and all of them are passing except the test for my #create method. I cannot seem to get this test to pass. I understand that the UnknownFormat error is related to which format I am using (and the…
rock_n_rolla
  • 337
  • 4
  • 13
0
votes
1 answer

IntegrationTest raises errors from configuration?

I have some problems while testing my Rails aplication. I have the simple following file to test a controller (relying on http://guides.rubyonrails.org/testing.html): require "./test/test_helper" class GraphControllerTest <…
M. S.
  • 33
  • 1
  • 6
0
votes
2 answers

Rails responds with status code 406

I have been working on a test for my function inside Ruby on Rails. However, the test (which expects a status code of :success) fails after receiving a status code 406. Here's the exact failure log: Failure: Expected response to be a <:success>, but…
0
votes
1 answer

How to capture request in Rails routes?

I need to conditionally set the param option in routes. Without condition it's easy: resources :foo, param: :uuid do #... end What I ideally want is something along the following lines (not working obviously): resources :foo, param: ->(req) {…
Andrey Deineko
  • 51,333
  • 10
  • 112
  • 145
0
votes
1 answer

How to skip / mock a test when no block is provided in Rails 5

I was having trouble figuring out how to stub out tests in Rails in the manner that Rspec does, without the rest of the Rspec baggage.
zachaysan
  • 1,726
  • 16
  • 32
0
votes
1 answer

Change scope of :new action in Rails3 routes to :member

I need to match /entries/slug-here/new and send it to EntriesController#new Tried following ways, both didn't work :( resources :entries do member do get :new end end resources :entries do get :new, :on => :member end Temporary hardcoded…
pleax
  • 1
  • 1
0
votes
0 answers

How to disallow uploading executable files using Ruby UploadedFile?

I'm using ActionDispatch::Http::UploadedFile.new with my Grape project to upload files. I'm not using any gem like paperclip to the job and I want to validate the file type and not to allow executable files. From the documentarians seems I can use…
Eki Eqbal
  • 5,779
  • 9
  • 47
  • 81
0
votes
1 answer

ActionDispatch::Static in Rails production environment

I'm looking to use ActionDispatch::Static to serve static files in a directory other than public. It works perfectly in development, but I can't seem to get the same results in production. I have my static files in /var/www/mysite.com-static. In an…
Ray Zane
  • 236
  • 1
  • 4
  • 10
0
votes
1 answer

Attr_reader for Active Record model attribute

Article.rb < ActiveRecord::Base ... attr_reader :title def title self.title.gsub(/"/," ") end end I am trying to overwrite the way each articles title is displayed because it looks ugly if I don't but I keep getting an error like…
Kohl
  • 77
  • 1
  • 15
0
votes
1 answer

Rails routing error while using griddler gem

I'm facing a strange issue on route added by griddler in my rails app. routes.rb excerpt: # mount griddler using default path: /email_processor post '/email_processor' => 'griddler/emails#create', as: :email_processor Rake routes $ bundle exec…
Indyarocks
  • 643
  • 1
  • 6
  • 26