title
is a local variable. They only exists within its scope (current block)
@title
is an instance variable – and is available to all methods within the class.
You can read more here:
http://strugglingwithruby.blogspot.dk/2010/03/variables.html
In Ruby on Rails – declaring your variables in your controller as instance variables (@title
) makes them available to your view.