Forum: Ruby on Rails undefined method `stringify_keys'

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
775b1c27ba2dcbd4c26438b8a557f0a2?d=identicon&s=25 Bahadır Doğan (xyzt)
on 2007-07-22 23:07

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 %>
<label for="username">Username>/label><br/><%= text_field_tag 'user',
nil, 'username' -%>
<label for="password">Password</label><br/><%= password_field_tag
'user', nil, 'password' -%>
<label for="email">E-mail</label><br/> <%= 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.

E60b2dc57668b5662ce3f07781e41710?d=identicon&s=25 Matthew Rudy Jacobs (matthewrudy)
on 2007-07-23 00:33
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' -%>
775b1c27ba2dcbd4c26438b8a557f0a2?d=identicon&s=25 Bahadır Doğan (xyzt)
on 2007-07-23 00:38
thanks, that solved the problem.
This topic is locked and can not be replied to.