How to write a test hash for a nested form?

How to write a hash for a nested form??

Example form fields (main model is Practice, nested is User):
practice[name]
practice[users_attributes][0][email]

I want to do this:

post:
post :create, :practice => { :name => “any name”, :users_attributes =>
{
:0 => { :email => “[email protected]” } } }

The issue is that I can not create a symbol for 0 - :0 and :0.to_sym
don’t
work and “0”.to_sym and ‘0’.to_sym give me the weird :“0”. So how can I
hack
this through? Is there another way to create such a hash which bypasses
need
for symbols which the controller will still understand?

Thanks,

David

You do not need it to be symbols I guess. I think that string will
work just fine.
Anyway. You can create symbols also this way:

:“123”

Robert Pankowecki

Thanks Robert, that worked great. Just looks a little weird at first to
do
:“0”.

On Sun, Oct 3, 2010 at 3:57 AM, Robert Pankowecki (rupert) <

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs