This only seems to occur when using Apache and Safari, If I use Firefox, the problem goes away, and if I use webrick and Safari, it's okay. sam- in IRC said this might be due to a workaround with the AJAX to deal with Safari. The crucial bit is in the apache.log output.
development.log:
Processing AccountController#preferences (for 127.0.0.1 at Wed Mar 23 12:57:10 PST 2005)
Parameters: {"action"=>"preferences", "preferences.html"=>nil, "controller"=>"account"}
Rendering account/preferences within layouts/application
Rendering layouts/application (200 OK)
Completed in 0.251110 (3 reqs/sec) | Rendering: 0.242287 (96%) | DB: 0.014209 (5%)
apache.log:
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.6.0/lib/action_controller/cgi_ext/raw_post_data_fix.rb:40:in `[]=': bad environment variable value (ArgumentError)
from /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.6.0/lib/action_controller/cgi_ext/raw_post_data_fix.rb:40:in `read_query_params'
from /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.6.0/lib/action_controller/cgi_ext/raw_post_data_fix.rb:14:in `initialize_query'
from /usr/local/lib/ruby/1.8/cgi.rb:2269:in `initialize'
from /usr/local/lib/ruby/gems/1.8/gems/rails-0.11.0/lib/dispatcher.rb:28:in `new'
from /usr/local/lib/ruby/gems/1.8/gems/rails-0.11.0/lib/dispatcher.rb:28:in `dispatch'
from /Users/schubert/Sites/weird/public/dispatch.cgi:10
[Wed Mar 23 12:57:26 2005] [error] [client 127.0.0.1] Premature end of script headers: /Users/schubert/Sites/weird/public/dispatch.cgi
preferences.rhtml:
<%= form_remote_tag(:url => {:controller => 'account', :action => 'update_with_ajax'},
:html => {:class => 'user'},
:update => 'users',
:loading => "Toggle.display('flash-message');
$('flash-message').innerHTML = 'Saving Preferences...'",
:complete => "Toggle.display('flash-message');
$('flash-message').innerHTML = 'Preferences Saved'") %>
<label for="user_login"><b>Username:</b> </label>
<%=h @user.login %><br /><br />
<%= hidden_field "user", "login" %>
<label for="user_email"><b>Email Address</b></label><small> (Required)</small><br />
<%= text_field "user", "email" %><br />
<label for "user_first_name"><b>First Name</b></label><small> (Optional)</small><br />
<%= text_field "user", "first_name" %><br />
<label for "user_last_name"><b>Last Name</b></label><small> (Optional)</small><br />
<%= text_field "user", "last_name" %><br />
<%= submit_tag "Save", :onclick => "Toggle.display('flash-message');" %>
<%= end_form_tag %>
AccountController:
def update_with_ajax
@user = find_user
@user.attributes = @params['user']
@user.email = load_email_attribute # Protected attribute, explicit assignment
if @user.save
render_action 'preferences'
else
render_action 'preferences'
end
end
end