rails session handling on windows problems

I'm doing a simple demo on a windows box, showing how simple it is to
do a user login page, using code from the Agile Programming with Rails

Unfortunately, it's not acting simple.

This is the view for the login.

<% @page_title = 'Login' %>
<%= error_messages_for 'user' %>


<% if session[:user_id] %>
<%= start_form_tag :action => 'login' %>
  <%= render :partial => 'users/form' %>
  <%= submit_tag "Login" %>
<%= end_form_tag %>
<% else %>
<p>You are logged-in.</p>
<% end %>

<% if session[:user_id] %>
<p>You can logout here.</p>
    <%= link_to 'Logout', :action => 'logout' %>
<% end %>

Even though both of these sections depend on the :user_id symbol in the
session hash, the first one is working and the second is not.

Also, while logout will run when told, for some reason it stays

Here are the login and logout actions.

def login
        if request.get?
            session[:user_id] = nil
            @user = User.new
            @user = User.new(params[:user])
                logged_in_user = @user.try_to_login
                flash[:notice] = "System error in login attempt!"
            if logged_in_user
                session[:user_id] = logged_in_user.id
                flash[:notice] = "Logged in as #{logged_in_user.name}!"
                redirect_to(:controller => 'login', :action => 'index')
                flash[:notice] = "Invalid user/password combination"

  def logout
    session[:user_id] = nil
    flash[:notice] = "You are logged-out"
    redirect_to(:action => 'index')

I'm lost. I'm doing something similar on a linux box and it works fine.

Is this a problem with Rails on Windows?


Keynan Pratt wrote:

#First change the view to be

<%= error_messages_for 'user' %>

<h1><%= @page_title || 'Login' %></h1>

<% if @logged_in? -%>

What provides @logged_in? ? That looks like a method call but you're
referencing it like an instance variable, and it's nowhere in my code.

I do see that my logic was bad here, but worse, in my controller, if
you visit the login page you are logged-out. This was the core issue.