Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 7.2.1, Ransack 4.2.1 ransack is not working. #1519

Open
orkhan opened this issue Aug 29, 2024 · 2 comments
Open

Rails 7.2.1, Ransack 4.2.1 ransack is not working. #1519

orkhan opened this issue Aug 29, 2024 · 2 comments

Comments

@orkhan
Copy link
Contributor

orkhan commented Aug 29, 2024

Ransack is not working, it's not returning filtered results. Just all results

Started GET "/api/v1/stations?q[station_plug_types_plug_type_id_eq]=bfce2465-c064-423b-bb72-7cc7af2039f7&q[max_kwh_eq]=0" for ::1 at 2024-08-29 17:24:35 +0400 Processing by Api::V1::StationsController#index as JSON Parameters: {"q"=>{"station_plug_types_plug_type_id_eq"=>"bfce2465-c064-423b-bb72-7cc7af2039f7", "max_kwh_eq"=>"0"}} Unpermitted parameter: :format. Context: { controller: Api::V1::StationsController, action: index, request: #<ActionDispatch::Request:0x0000000127494d00>, params: {"q"=>{"station_plug_types_plug_type_id_eq"=>"bfce2465-c064-423b-bb72-7cc7af2039f7", "max_kwh_eq"=>"0"}, "format"=>:json, "controller"=>"api/v1/stations", "action"=>"index"} } Ransack::Search<class: Station, base: Grouping <conditions: [Condition <predicate: eq, values: ["bfce2465-c064-423b-bb72-7cc7af2039f7"]>, Condition <predicate: eq, values: [0]>], combinator: and>> Station Load (0.6ms) SELECT DISTINCT "stations".* FROM "stations" LEFT OUTER JOIN "station_plug_types" ON "station_plug_types"."station_id" = "stations"."id" ↳ app/controllers/api/v1/stations_controller.rb:7:inindex'
Provider Load (0.3ms) SELECT "providers".* FROM "providers" WHERE "providers"."id" = $1 [["id", "9a2f9e1b-87df-4538-aaf8-16efe51055ee"]]
↳ app/controllers/api/v1/stations_controller.rb:7:in index' HABTM_Amenities Load (0.2ms) SELECT "amenities_stations".* FROM "amenities_stations" WHERE "amenities_stations"."station_id" = $1 [["station_id", "34286d84-8c3f-4bf6-9d7a-bb03845ec0c6"]] ↳ app/controllers/api/v1/stations_controller.rb:7:in index'
Amenity Load (0.3ms) SELECT "amenities".* FROM "amenities" WHERE "amenities"."id" = $1 [["id", "9b57b6b2-c45a-4706-b474-6079d657f6fe"]]
↳ app/controllers/api/v1/stations_controller.rb:7:in index' City Load (0.2ms) SELECT "cities".* FROM "cities" WHERE "cities"."id" = $1 [["id", 1]] ↳ app/controllers/api/v1/stations_controller.rb:7:in index'
StationPlugType Load (0.2ms) SELECT "station_plug_types".* FROM "station_plug_types" WHERE "station_plug_types"."station_id" = $1 [["station_id", "34286d84-8c3f-4bf6-9d7a-bb03845ec0c6"]]
↳ app/controllers/api/v1/stations_controller.rb:7:in index' State Load (0.2ms) SELECT "states".* FROM "states" WHERE "states"."id" = $1 [["id", 1]] ↳ app/controllers/api/v1/stations_controller.rb:7:in index'
PlugType Load (0.3ms) SELECT "plug_types".* FROM "plug_types" WHERE "plug_types"."id" = $1 [["id", "bfce2465-c064-423b-bb72-7cc7af2039f7"]]
↳ app/controllers/api/v1/stations_controller.rb:7:in index' Country Load (0.3ms) SELECT "countries".* FROM "countries" WHERE "countries"."id" = $1 [["id", 1]] ↳ app/controllers/api/v1/stations_controller.rb:7:in index'
[active_model_serializers] Rendered ActiveModel::Serializer::CollectionSerializer with ActiveModelSerializers::Adapter::Attributes (1.72ms)
Completed 200 OK in 21ms (Views: 17.2ms | ActiveRecord: 2.5ms (9 queries, 0 cached) | GC: 4.9ms)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants