Strange redirection with 0 bytes transferred

Good day,

I am implementing a site with RoR. The main page is a list with some filters. I created the filter form with form_tag and a get request.

However, for some reason, the first request, with the url parameters, returns 0 bytes and redirects to the same url but with no url parameters.

I added some puts in the method of the controller that is related to that view and the method works fine; but when it tries to render the page, it is redirected.

I am using rails 5.2.4.4; the application is running with docker.

What am I missing? why is this happening?

Thank you,

I think more information will be needed here. Like the full url, the controller, the routes, the options of the browser console, the code of the form_tag. Why do you have form_tag with get?

Good day, @kmitov

I need to create a filter that uses url params to define the values; something like Example Domain .

I search and the only option I found was to use form_tag with get method. Is there a better approach?

Thank you,

There are a lot of options. I assume you’ve selected the one that fits your needs. But for implementing filters I’ve personally used in different contexts

  1. Simulus controllers that send GET requests
  2. Simple GET requests
  3. Post Request
  4. Gems like Filterrific
  5. jQuery based filtering.
  6. and you can use the form_tag with get method

There are options. The most recent that I’ve used is number 1. My point is there probably isn’t a better approach, but different depending on what you have.

If you could share more of your code or an example app it would be much easier for me or others to help.