Ruby on Rails Get Query Filter
Given a GET request is made to “/users?<some-query-here>”, then all users that meet the query criteria are returned in a JSON array, and the status code is 200.
first we will create our index action that renders users and set a before_action that calls filter_users before the index action is called.
class UsersController < ApplicationController
before_action :filter_users, only: %i[ index ] # GET /users
render json: @users, status: :ok