Hello,
I'm trying the search method used in the Guides:
and I don't know what is coming back to the controller when a text box
is empty. When each of the 2 text boxes (described below) have a
value then the search works. However, if the second box is empty then
nothing is returned, even though there is data to match the first box.
The boxes are formed in the search.html.erb as:
if @skill_search2.empty?
@found_people = Person.where("skill_set LIKE ?",
params[@skill_search1])
else
@found_people = Person.where("skill_set LIKE ? and skill_set
LIKE ?", params[@skill_search1],params[@skill_search2])
end
end
I have also tried: if @skill_search2 == NUL, == " ",== nil,
=='' and ="" under the theory that if you type in everything then
something might work (hey, it's worked in the past!).
Looking at the output in the command window that is used for the
"rails server" call to WEBRick it seems that the second conditional
option is always called and the statement ends in "and skill_set LIKE
''" (that is 2 apostrophes before the final quote and, while it's a
little hard to judge, I don't think there is a space between the
apostrophes).
So the question is: what is being returned by the blank text box
and how should it be checked?
Thanks,
Barney
Hi Eric,
I'm using Scite and there doesn't seem to be a debugger in it.
How else would I check that hash?
But, could you tell me what form (type, value) is the return from
that empty text box?
Thanks,
Barney
The debugger call will stop the execution and drop you into the debugger - it's not from within your text editor - it's in the
terminal window where you run your app
Thanks Eric, I didn't know about the debugger.
When I ran: rails server --debugger I got the error that I needed to
install ruby-debug with 'gem install ruby-debug' but when I did the
error: "Failed to build gem native extension." and then there were a
bunch of errors involving "no member" in RArray and RString. I then
successfully installed ruby-debug-ide19-0.4.12, "but the rails server
--debugger" gave the same error as before. Maybe I need to ask this
in a separate question, but if you know the answer to the problem off-
hand I'd appreciate knowing it.
Thanks,
Barney