You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently implementing a search form in our users database. I would like to search by id , by login or by email.
Naturally, I think that the best aproach is to combine scopes and simplify the form. So I added a text_field for :id_or_login_or_email_like.
Everything works fine when I type a number in the text-field.
However, when I type a word and press search, the value i typed is losed and replaced with a 0 (zero) and the search result returns all users that have 0 in the ID, name or login.
Any ideas on how to fix this? I'm using Rails 2.3.2 and SearchLogic 2.4.27.
Thanks!
The text was updated successfully, but these errors were encountered:
Got an answer on StackOverFlow. I'm copy/paste it here, hoping someone will clear the mistery:
"I think this is because your scope is making a comparison against an integer when comparing to id, which causes your string to be converted to 0. Try using .dup to ensure that the passed attribute to the scope is not changed."
Hello,
I'm currently implementing a search form in our users database. I would like to search by id , by login or by email.
Naturally, I think that the best aproach is to combine scopes and simplify the form. So I added a text_field for :id_or_login_or_email_like.
Everything works fine when I type a number in the text-field.
However, when I type a word and press search, the value i typed is losed and replaced with a 0 (zero) and the search result returns all users that have 0 in the ID, name or login.
Any ideas on how to fix this? I'm using Rails 2.3.2 and SearchLogic 2.4.27.
Thanks!
The text was updated successfully, but these errors were encountered: