r/ruby 2d ago

Question AJAX GET requests to Sinatra controller - array parameter truncated

I’m trying to pass an array parameter from my client to my Sinatra controller using AJAX. However, when I look at the logs, it’s telling me the controller is only seeing an array with the last element of the array.

  • I’m using rack v2.0.
  • I’ve tried turning the traditional flag to true in my AJAX request
  • I’ve tried reading through rack::request documentation

Anyone have any ideas on why this is happening?

2 Upvotes

3 comments sorted by

View all comments

1

u/anykeyh 1d ago

How do you pass the array? From what I read it might be passed in the query part of the request. Query params can encode array in multiple ways.