Scenario for using instance vars to pass data to layouts and templates, and prevent

changes to instance vars being shared between different templates.
This commit is contained in:
Ben Hollis 2011-12-06 23:24:14 -08:00
parent 9b07bf24dd
commit 97dc2c9742
7 changed files with 41 additions and 6 deletions

View file

@ -0,0 +1,5 @@
<% if @my_var %>
My var is here!
<% else %>
No var...
<% end %>

View file

@ -0,0 +1,2 @@
<% @my_var = 100 %>
<%= partial 'vartial' %>

View file

@ -0,0 +1,3 @@
Var is <%= @my_var %>
<%= yield %>

View file

@ -0,0 +1 @@
<%= partial 'vartial' %>