Hi,

are you sure its a string? just check with @state.class, and also try to
print the value before the if (so as to confirm its not getting modified
later on)

-NAYAK

On Wed, Jan 7, 2009 at 11:38 PM, Fididle Fididle <
[email protected]> wrote:

>
> 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
> -----
>
> ...
>
> <p>DEBUG: @state = <%= @state %><br \>
>   DEBUG: @debug = <%= @debug %><br \>
> </p>
> ...
>
>
> --------------
> rendered page
> --------------
>
> DEBUG: @state = ALL
> DEBUG: @debug = 0
>
>
> Thanks!
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to