This project is archived and is in readonly mode.

#4431 ✓resolved
David Chelimsky

inconsistent support in assigns API

Reported by David Chelimsky | April 17th, 2010 @ 08:55 PM

On, the docs say you can access assigns with assigns(:key).

It turns out that you can actually access assigns in any of these three ways:


But you can not access assigns with assigns[:key]. Actually, you can use assigns[:key], but it always returns nil, leading to false results in tests with no indication that you're doing something wrong.

My thought is that if you can use strings or symbols with assigns(...), you should probably be able to use strings or symbols with assigns[...]. The alternative would be to prevent access with keys (or warn in that case), but that seems like overkill to me.

Here's a patch to handle the more flexible case:

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=""></a>

People watching this ticket

Referenced by