This project is archived and is in readonly mode.

#1096 ✓committed
Nate Wiger

Rails slice() helper incompatibility in Rails 2.1.1

Reported by Nate Wiger | September 23rd, 2008 @ 12:04 AM | in 2.x

String.slice used to return the same types of keys as the original hash. As of Rails 2.1.1, however, it always returns stringified keys.

You can see this behavior in a snipped like the following:

user_params = params.slice(:username, :password)

In Rails 2.1.0 and earlier, you could then say:

user_params[:username] user_params[:password]

However, in Rails 2.1.1, you can only get to them stringified:

user_params['username'] user_params['password']

Attempting to use the symbols yields nil values.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages