Created
February 25, 2011 11:41
-
-
Save duritong/843686 to your computer and use it in GitHub Desktop.
How can I access `state` in the included template?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
<%= scope.methods.sort.join("\n") %>
<%- [:foo, :bar].each do |state|
scope.unsetvar('foostate')
scope.setvar('foostate',state)
%>
<%= scope.function_template('/tmp/foo2.erb') %>
<%- end %>