Skip to content

instance variable In Rails

richlewis14 edited this page Nov 6, 2012 · 4 revisions

An instance variable is a variable that is an instance of its class.

example

Within Controller

  @latestrecipe = Recipe.order("created_at desc").limit(5)

The class in this case (which is a model) is Recipe, @latestrecipe is an instance of this class