Fearless Fool
2011-Nov-08 00:21 UTC
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-OMsI0saeytcAvxtiuMwx3w@public.gmane.org). 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?
TIA
- ff
P.S.:
% 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
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Fearless Fool
2011-Nov-08 00:33 UTC
Re: why is my text_field getting a default value of current_user.email?
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. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Fearless Fool
2011-Nov-08 00:50 UTC
Re: why is my text_field getting a default value of current_user.email?
[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
%>
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Michael Pavling
2011-Nov-08 06:34 UTC
Re: Re: why is my text_field getting a default value of current_user.email?
On 8 November 2011 00:50, Fearless Fool <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> [silly forum code won''t let me edit previous reply.]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 ;-) The "ruby-forum" is just a wrapper for the Google Groups list. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.