[Long] Problem with Ajax.Updater


#1

app/views/layouts/application.rhtml:

<?xml version="1.0"?> <%= title %> <%= javascript_include_tag "prototype" %> <%= stylesheet_link_tag "application.css" %> <%= stylesheet_link_tag "#{controller.controller_path}.css" %>
<%= render :partial => 'layouts/sidepane' %>
<%= @content_for_layout %>
app/view/layouts/_sidepane.rhtml:
<% if @user.nil? %>

Please log in

<% form_remote_for :login, :update => "sidepane", :url => "/login/sidepane" do |f| %>
Id: <%= f.text_field :id %>
Password: <%= f.password_field :pass %>
<%= submit_tag "Log in" %>
<% end %> <% else %>

User

First name: <%= @user.first_name %>
Last name: <%= @user.last_name %>
<% form_tag "/login/logout" do %> <%= submit_tag "Log out" %> <% end %>
<% end %>
app/controllers/login_controller.rb: class LoginController < ApplicationController def sidepane do_login params[:login] if request.post? render :partial => 'layouts/sidepane' end

def logout
session[:user_id] = “”
redirect_to “/”
end

def do_login login
if request.post?
# I’m add password checking later
session[:user_id] = User.find(login[:id])
end
end

private :do_login
end

If I try to login it deletes div#main (firebug said it as well) and do
not update div#sidepane. What’s wrong?

Regards


I’ve probably left my head… somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)