why is my text_field getting a default value of current_user.email?

I have a form containing a text field along the lines of:

<%= form_for(wizard, :url => wizard_path, :method => :put) do |f| %>
    <%= form.text_field "gas_credentials[user_id]", :value =>
wizard.gas_credentials['user_id'] %>
<% end %>

Mysteriously, when wizard.gas_credentials is nil, the text_field gets
initial text equal to the current_user.email (which in this case is
admin@admin.com). At the very least, I'd expect an error trying to call
[] on nil.

What's especially odd is that the wizard model knows nothing about
current_user, so I don't see where it's getting that value from. Can
anyone shed light on what might be happening, or at least how text_field
decides to compute its :value?


- ff


% rake about
About your application's environment
Ruby version 1.9.2 (x86_64-darwin10.6.0)
RubyGems version 1.3.7
Rack version 1.2
Rails version 3.0.5
Environment development

... and I'm using devise 1.4.2 and warden 1.0.4

Doh! The answer: browser autocompletion. I'm leaving this post in
place rather than deleting it out of shame in the faint hope that it
might save someone else a few minutes of head scratching.

[silly forum code won't let me edit previous reply.]

To prevent autocompletion, you can do something like:

    <%= form.text_field "gas_credentials[user_id]",
            :value => wizard.gas_credentials['user_id'],
            :autocomplete => :off

That's because it's a mailing list... and even if every other
subscriber let you come around to their house and edit their emails, I
wouldn't :wink:

The "ruby-forum" is just a wrapper for the Google Groups list.