Questions tagged [actiondispatch]

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

84 questions
1
vote
0 answers

Monkey patching ActionDispatch::Routing::PolymorphicRoutes polymorphic_path causes stack level too deep

I monkey patched the polymorphic_path method, because I wanted to add a nil locale whenever the locale was the same as the default locale. The method looks like this: module ActionDispatch module Routing module PolymorphicRoutes …
1
vote
2 answers

Optimizing Rails routing definition

We have about 650 routes defined in our Rails 3.2.22 app. Around 20 of them make up over 90% of our requests. These 20 all fall under an optional scope: (/:api_version). Where is the most optimal place to define these routes. Is it at the beginning…
bschaeffer
  • 2,824
  • 1
  • 29
  • 59
1
vote
1 answer

Rails 3 ActionDispatch scope options

Do you know a resource which documents all the available options for the ActionDispatch scope method and their usage? I'm quite tired of digging into each merge_X_scope method trying to understand the X option implications.
Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
1
vote
1 answer

Zend Framework 2 - Check for authentication in abstract controller -> onDispatch?

I am re-writing the authentication process for my application running under ZF2. I need to have more options to authenticate the user depending on the service called. I.E. for web application accessed from browser I will authenticate via Ldap and…
1
vote
1 answer

Rails integration test to select for presence of correct button text

I am running through the Hartl Rails Tutorial and have completed the exercises in 9.60, 9.61, 9.62 that call for refactoring of the new and edit form code with a new partial. The forms now use 'provide' to supply button text as in: <%…
dtburgess
  • 613
  • 5
  • 19
1
vote
2 answers

Possible oneliner for this Ruby on Rails code

I have a file object which is of type Rails ActionDispatch::Http::UploadedFile. I need to overwrite user assigned filename with a generic name while preserving the extension of the file. This is how I have the code implemented currently. Is there…
Ramya
  • 107
  • 1
  • 1
  • 12
1
vote
1 answer

ERROR bad Request-Line `m-urlencoded' while posting a GET request from python to rails

I am using request package in python to ping one localhost url on rails. My request header has four extra things which I attached. s = Session() req = Request('GET', url, data = payload) prepped =…
Shilpi Agrawal
  • 595
  • 3
  • 11
  • 26
1
vote
1 answer

How to rescue_from ActionDispatch::Cookie::CookieOverflow?

First at all, I have read: Cookie overflow in rails application? And this is not the problem that I'm facing. I'm working with: gem "rails", "~> 3.2.11" and ruby 1.9.3-p125 I'm trying to process a search, and when the search is tooooooo big I get…
nisevi
  • 627
  • 1
  • 10
  • 27
1
vote
2 answers

Rails restrict wildcard route to certain format

I have a wildcard route in my routes.rb file: get "*client" => "client#show" In the controller, I look up the client in the database and display their custom page: def show @client = Client.find_by(slug: params[:client]) if @client.nil? …
stephen.hanson
  • 9,014
  • 2
  • 47
  • 53
1
vote
2 answers

rails4 upload file extension error ActionDispatch::Http::UploadedFile

Guy now i want to upload file with rails 4 my problem now i can't check the file extension before upload it Note : I can upload the file well but i want to get the file kind before upload it because i need the extension in another step in my…
Astm
  • 1,519
  • 2
  • 22
  • 30
0
votes
0 answers

ngrok warning page does not dissappear when using redirect_to

I have a shopify checkout proxy app which I am developing and testing on ngrok. Whenever the redirect_to command is used to redirect to an action within my checkout app using the proxy URL. The ngrok error warning comes and does not go away no…
0
votes
0 answers

ActionDispatch::Request::Session keeps giving the following error: *** NoMethodError Exception: undefined method `key?' for nil:NilClass

I am trying to set some attributes in a before_action of a store with multi step checkout behaviour. All the before_action does is set some attributes for session session[:checkout_attributes] ||= {} but after the first step I keep getting the…
Jibran Usman
  • 93
  • 1
  • 5
0
votes
1 answer

How can we disable the session to expire automatically in rails?

how can we have a Rails application without a session expiring automatically within specific period of time. Or if the question can't bring a clear picture, is it okay to just delete the the line expire_after: 3.day, from config.middleware.use( …
0
votes
1 answer

initialState resets after dispatch actions in react useReducer

In my app, I fetch users data from the server inside the useEffect hook and set the initialState of the useReducer. When action dispatch happens on text input change, the initialState resets instead of updating thus I can't type a word inside the…
0
votes
1 answer

How to serve static content from gems in Sinatra (analagous to Rails ::ActionDispatch::Static)

I have a Sinatra service which includes a gem. The gem contains some static content which I would like to include in and serve via the Sinatra app. In Rails this would be done with ActionDispatch. Here is an…
johnmartirano
  • 415
  • 4
  • 9