Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's impossible to pass ERB variables to #template (the only way to "pass" variables is to define methods) #120

Open
carllerche opened this issue Apr 5, 2011 · 2 comments

Comments

@carllerche
Copy link

This doesn't work with quick one off template generation tasks.

@devboy
Copy link

devboy commented Jun 30, 2011

I am having the same problem, it seems to work in Bundler though.
See my question on StackOverflow: http://stackoverflow.com/questions/6498058/passing-options-to-template-function-in-thor

@workergnome
Copy link

I'm sure I'm missing something in the documentation, but I can get it to work if I reference it like so:

in install.thor

def  install
    opts = {:name => 'Workergnome'}
    template "templates/install.tt", "install.txt", opts 
end

in templates/install.tt

My name is <%= config[:name] %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants