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 => “anyone@gmail.com” } } }
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