Tutorial :Ruby on Rails: Including multiple instance variables in partials



Question:

So... I know about the :locals => { :var1 => @rawr, :var2 => @hello } syntax for partials
but is there a way for me to pass both @rawr and @hello to the partial, so that i don't need to use var1 and var2?


Solution:1

You can do :locals => { :rawr => @rawr, :hello => @hello } and then the variables will be available within the partial as rawr and hello.


Solution:2

You know, you could just use @rawr and @hello ... and NOT pass any variables.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »