What is ivar in a Rails controller?

I can see the ivarterm mentioned many times here https://github.com/rails/rails/issues/18950#issuecomment-77924771 , but cannot find a direct explanation of what iVar is.

What is it and can this term be used outside the context of the controller?

+4
source share
1 answer

ivar means an instance variable. An instance variable is bound to an object of this class, and in rails it is mainly used in controllers and views.

github, : "iVars " API " .

, :

def new
  @post_ivar = Post.new
end

"ivar" , new.haml:

= form_for @post_ivar do |f|
  = f.text_field :headline
  -# ...
+5

Source: https://habr.com/ru/post/1613363/


All Articles