while learning Rails, I keep hearing Local vs Instance but I can't find a definition of the two & the differences. And I'd like to avoid making assumptions.
What are the two and how are they different?
Thanks
Join Stack Overflow to learn, share knowledge, and build your career.
while learning Rails, I keep hearing Local vs Instance but I can't find a definition of the two & the differences. And I'd like to avoid making assumptions.
What are the two and how are they different?
Thanks
The main differences between local and instance variables are as follows
The main difference between local and instance variable is that local variable is only available in controller, where as instance variable is available in corresponding views also. The controller and views do not share local variables.
Thanks, Anubhaw
render :index, :locals => { :stuff => @stuff }
– hangsu
Apr 28 '14 at 19:31