Today’s lesson (for me, a Rails noob :D) is about how to pass variables to Rails partials.
I kept getting error when I tried to pass a variable to a partial with this method:
It turned out that when I use the :partial key, I need to wrap the variable to be passed inside a hash named :locals. Meanwhile, if I want to pass the variable without :locals hash, I must pass the path as a string instead of using the :partial key. So the correct codes are either this:
Thanks to xinuc for pointing out my mistake :)