-
-
Notifications
You must be signed in to change notification settings - Fork 804
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
Ransack form search field value not persisted between requests when using alias #689
Comments
same here Ransack version: Database: PostgreSQL |
Any update on this? I'm having the same problem. |
If it helps anyone, I worked around this using
|
Same here. Ransack: 1.8.3 / 1.8.2 |
Same here Ransack: 1.8.3 |
Same bug here Ransack: 2.1.1 Also ransack sorting ignores aliases. |
This is happening for me also when using ransack with simple form, using an alias doesn't populate my checkboxes when the page refreshes after submitting the form. If I remove the alias everything works as expected |
This approach is also needed to keep values for a <div class="form-group">
<%= f.label :due_days_eq, t('Review_days') %>
<%= f.select :due_days_eq, options_for_select([0,1,2,3,4,5], params.dig(:q, :due_days_eq)), { include_blank: t('Any') } %>
</div> |
Just ran into this today as well. Created https://github.com/rspeicher/ransack-689-test to offer a minimal reproduction of the issue, and a failing system test. The I was able to trace it as far as ransack/lib/ransack/nodes/grouping.rb Lines 180 to 186 in dbffa8b
name_or_description_cont , but it's aliased as full_search_cont , but because the group naming uses the underlying, expanded name we get nothing back for the value.
I wonder if it would be possible to store the alias name alongside the group so either will return the value we need, or to have the form builder expand the alias before asking for the value. |
When I search, using an alias I cannot get the value of the searched parameter in the field.
In the name field I have tested and it's working fine.
My code:
In controller:
In model:
In view:
Ransack version:
GIT
remote: git://github.com/activerecord-hackery/ransack.git
revision: 64d8c40
I'm using Ransack directly with:
Database: PostgreSQL
Rails: 5.0.0.rc1
ruby 2.2.5
The text was updated successfully, but these errors were encountered: