Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would have thought that the file rendering solution for partials would be cached in production environment.


It is to some extent, the problem is in the semantic <%= render "foo" %> may end up rendering different partials based the context it's invoked from, e.g. current locale, etc.

So the cache can't just be a simple hash.

Additionally, once you have identified the template to render, if some locals are passed, you then need to lookup the compiled template for that specific combination of parameters, because `render "foo"` and `render "foo", name: "George"` end up compiling two versions of the same template.

For that later issue we just introduced a way to declare what locals a template accept which should allow us to improve that part: https://github.com/rails/rails/pull/45602


This is awesome. I’m going to use the heck out of this feature. I’ve been sticking # required: at top of my templates.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: