@ sign, quick question

@ sign means instance. the reason it is used in a controller is because
it is global, hence the reason it can be accessed in a view? without the
@ sign means it is local to the function right?

bbqPlate wrote:

@ sign means instance. the reason it is used in a controller is because
it is global, hence the reason it can be accessed in a view? without the
@ sign means it is local to the function right?


Posted via http://www.ruby-forum.com/.

@ means an instance variable. It’s not really global it’s local to the
controller, but rails copies all controller instance variables to views
when they are rendered so they are accessible there as well.

_Kevin

thx kevin.

_Kevin wrote:

bbqPlate wrote:

@ sign means instance. the reason it is used in a controller is because
it is global, hence the reason it can be accessed in a view? without the
@ sign means it is local to the function right?


Posted via http://www.ruby-forum.com/.

@ means an instance variable. It’s not really global it’s local to the
controller, but rails copies all controller instance variables to views
when they are rendered so they are accessible there as well.

_Kevin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs