-
Notifications
You must be signed in to change notification settings - Fork 3
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
[GRO-15761] Added new attribute on class SqlSort which would keep nul… #47
[GRO-15761] Added new attribute on class SqlSort which would keep nul… #47
Conversation
…ls last to sort order if configured in the object
else | ||
direction = "desc nulls last" | ||
end | ||
else | ||
direction = "asc" | ||
direction = @keep_nulls_last ? "asc nulls last" : "asc" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NileshN How do you enable this variable? It is by default false.
If I want to support the asc nulls last then we need to send this parameter to the query_helper.update method from our application right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question @AjitKonde-Pattern. Here is the way to enable value to this attribute from the query-helper object:
@query_helper.update(........., sql_sort: QueryHelper::SqlSort.new( sort_string: params[:sort], keep_nulls_last: true ))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NileshN
Solution to this. In query_helper(lib/query_helper.rb) update method, you need to add below code:
@sql_sort.keep_nulls_last= keep_nulls_last if keep_nulls_last
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In application, you just need pass the value:
@query_helper.update(query: query, keep_nulls_last: true)
…ls last to sort order if configured in the object