Hi, Please help me with this maddening little problem.
The if statement in the controller (below) does not detect the string
“ALL” contained in params[:state]. This param was entered in a form
(not shown here).
I can see on the rendered page (below) that this variable is indeed
present in the ‘@state’ variable as it is rendered correctly.
The question then is why the if ‘@state == “ALL”’ condition is not
“true”? If it were true, @debug should be == 1.
I have also tried using a regex ‘if @state =~ /ALL/’ to no avail.
Thanks!
controller
…
def search
…
@state = params[:state]
@debug = 0
if @state == “ALL”
@debug = 1
end
…
end
view
…
DEBUG: @state = <%= @state %>
DEBUG: @debug = <%= @debug %>
rendered page
DEBUG: @state = ALL
DEBUG: @debug = 0
Thanks!