Skip to content

Instantly share code, notes, and snippets.

@duritong
Created February 25, 2011 11:41
Show Gist options
  • Save duritong/843686 to your computer and use it in GitHub Desktop.
Save duritong/843686 to your computer and use it in GitHub Desktop.
How can I access `state` in the included template?
#some_template.erb
<%- [:foo, :bar].each do |state| %>
<%= scope.function_template('some/other_template.erb') %>
<%- end %>
# some/other_template.erb
<%- if state == :foo %>
write something
<%- end %>
@duritong
Copy link
Author

<%= scope.methods.sort.join("\n") %>
<%- [:foo, :bar].each do |state|
scope.unsetvar('foostate')
scope.setvar('foostate',state)
%>
<%= scope.function_template('/tmp/foo2.erb') %>

<%- end %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment