From ffc8254d30ee2d387975268913edbfc7d7067100 Mon Sep 17 00:00:00 2001 From: Girish Bhanarkar Date: Wed, 13 Oct 2021 13:47:34 +0530 Subject: [PATCH 1/2] Column order issue on select statement - task - https://app.clickup.com/t/1c5cry4 --- lib/query_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/query_helper.rb b/lib/query_helper.rb index 55ea8b3..e843992 100644 --- a/lib/query_helper.rb +++ b/lib/query_helper.rb @@ -165,8 +165,8 @@ def view_query end def execute_query - query = build_query() - @results = @model.find_by_sql([query, @bind_variables]) # Execute Sql Query + query = to_sql + @results = @model.connection.select_all(query).as_json # Execute Sql Query @results = @results.first if @single_record # Return a single result if requested determine_count() From c57fb29567d3c86800cb23d5be9cc02e20f877cb Mon Sep 17 00:00:00 2001 From: Girish Bhanarkar Date: Tue, 19 Oct 2021 21:42:31 +0530 Subject: [PATCH 2/2] add spec for association --- spec/rails_integration_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/rails_integration_spec.rb b/spec/rails_integration_spec.rb index 6c84e8d..577f0c4 100644 --- a/spec/rails_integration_spec.rb +++ b/spec/rails_integration_spec.rb @@ -101,6 +101,25 @@ end end + + url_params = { + filter: { + "id" => { + "gte" => 20, + "lt" => 40 + } + }, + page: Faker::Number.between(5,15).to_s, + per_page: Faker::Number.between(2,5).to_s, + sort: "name:desc", + include: "children" + } + + it "test include query" do + get :index, params: url_params + expect(response.status).to eq(200) + end + end end