You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into trouble with sharing stache templates between server and client on Rails 4.2.0. Once the template is rendered on the server, I get this error when calling template_include_tag in the template:
1) Some example
Failure/Error: Unable to find matching line from backtrace
ActionView::Template::Error:
undefined method `html_safe' for nil:NilClass
# ./app/views/pages/index.html.erb:3:in `_app_views_pages_index_html_erb__933758841857237125_70177580457500'
It looks like the problem is that when template_include_tag looks up the template and it was cached, template.source is nil. Based on the template refresh method, I gather this is intended, perhaps to keep the cache leaner.
The refresh method uses lookup_context.disable_cache to ensure the source is present. Doing the same inside of template_include_tag seems to fix the issue in my test case.
Would you like me to submit a pull request to address the issue that way? I don't have spec coverage for it within stache yet; I only have an integration test in my rails app that exercises the failure case.
The text was updated successfully, but these errors were encountered:
I'm running into trouble with sharing stache templates between server and client on Rails 4.2.0. Once the template is rendered on the server, I get this error when calling
template_include_tag
in the template:It looks like the problem is that when
template_include_tag
looks up the template and it was cached,template.source
is nil. Based on the templaterefresh
method, I gather this is intended, perhaps to keep the cache leaner.The
refresh
method useslookup_context.disable_cache
to ensure thesource
is present. Doing the same inside oftemplate_include_tag
seems to fix the issue in my test case.Would you like me to submit a pull request to address the issue that way? I don't have spec coverage for it within stache yet; I only have an integration test in my rails app that exercises the failure case.
The text was updated successfully, but these errors were encountered: