xyzt
1
Hello
I have a view for user registration but when i try to view this page i
get this error:
undefined method `stringify_keys’ for “username”:String
Here’s my registration.rhtml:
<% form_tag :controller => :user, :action => :register do %>
Username>/label>
<%= text_field_tag 'user',
nil, 'username' -%>
Password
<%= password_field_tag
'user', nil, 'password' -%>
E-mail
<%= email_field_tag 'user', nil,
'email' -%>
<%= submit_tag 'Register' -%>
<% end %>
What’s my problem and what does this error means? i’ve searched google
but couldn’t find enough info.
Thanks.
xyzt
2
The error is coming from your “text_field_tag”, “password_field_tag” and
so on,
you’ll see it goes
text_field_tag(name, value = nil, options = {})
but you’re doing
“user”, nil “username”
it expects the 3rd argument to be a hash,
and it calls “stringify_keys” on the hash.
I think you mean to be using
textfield(“user”, “username”)
Bahadır Doğan wrote:
undefined method `stringify_keys’ for “username”:String
<%= text_field_tag ‘user’, nil, ‘username’ -%>
<%= password_field_tag ‘user’, nil, ‘password’ -%>
<%= email_field_tag ‘user’, nil, ‘email’ -%>
xyzt
3
thanks, that solved the problem.