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

Can variables be passed to sub-templates? #95

Closed
bexelbie opened this issue Aug 10, 2017 · 2 comments
Closed

Can variables be passed to sub-templates? #95

bexelbie opened this issue Aug 10, 2017 · 2 comments

Comments

@bexelbie
Copy link
Contributor

I have _template/page.html.erb
it includes via <%= render("_templates/_footer.html.erb") %> a sub-template. That template can not use the images_path.

Is this a jinja limitation or something we can fix?

@Fryguy
Copy link
Contributor

Fryguy commented Aug 23, 2017

Does it work if you do something like:

<%= render("_templates/_footer.html.erb", :images_path => images_path) %>

Basically, render calls are a lot like function calls...they can only see the context they are given. The page is given a bunch of paths, but those won't trickle down unless you choose to pass them down. Here is an example for how the css_path is passed:

<%= render("_templates/_css.html.erb", :css_path => css_path) %>

@bexelbie
Copy link
Contributor Author

closing. Thank you @Fryguy

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

2 participants