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

[WIP] Template Handler Refactoring #34952

Merged
merged 9 commits into from
Jan 22, 2019
Merged

[WIP] Template Handler Refactoring #34952

merged 9 commits into from
Jan 22, 2019

Conversation

tenderlove
Copy link
Member

Someone at work wants to add a new way to do templating, so I've been poking at the way we do template compilation. I just want to try out some stuff here and see if it passes CI. Maybe we can merge some of it.

This pulls the "output buffer existence" conditional up.  Instead of
evaling the same conditional over and over, we can pull it in to "only
compiled once" Ruby code.
@rails-bot rails-bot bot added the actionview label Jan 16, 2019
Methods created by views should always be evaluated against an AV::Base
instance.  This way we can extract and refactor things in to classes.
@rails-bot rails-bot bot added the actionpack label Jan 17, 2019
It's always called with 0 params, so just remove the parameter
This patch removes the instance writer of view_context_class.
Subclasses may override it, but it doesn't need to be written.  This
also eliminates the need to cache the return value of the class level
`view_context_class` method.
We always want to include this module.  It'll be used in production
(maybe)
Rather than doing is_a? checks, ask the view object for its compiled
method container.  This gives us the power to replace the method
container depending on the instance of the view.
@tenderlove
Copy link
Member Author

I think these changes are safe, so I'm going to merge them. I've got some more, possibly less safe stuff that depends on these changes, so I'll send a new PR with them.

@tenderlove tenderlove merged commit db4b77a into master Jan 22, 2019
@tenderlove tenderlove deleted the template-stuff branch January 22, 2019 17:28
@rafaelfranca
Copy link
Member

👍

mrpinsky pushed a commit to polleverywhere/haml_coffee_assets that referenced this pull request Sep 3, 2020
As of rails/rails#34952, the fallback for nil
buffer was moved up to the method call's default argument. The `nil`
default here is passed to the original method (`old_render`), preventing
the default from being applied. This meant that any template going
through this monkey patch on Rails 6 blew up when it tried to call
methods on the buffer.
mathieujobin pushed a commit to payrollhero/haml_coffee_assets that referenced this pull request Feb 12, 2021
As of rails/rails#34952, the fallback for nil
buffer was moved up to the method call's default argument. The `nil`
default here is passed to the original method (`old_render`), preventing
the default from being applied. This meant that any template going
through this monkey patch on Rails 6 blew up when it tried to call
methods on the buffer.
derSascha pushed a commit to derSascha/haml_coffee_assets that referenced this pull request Apr 22, 2021
As of rails/rails#34952, the fallback for nil
buffer was moved up to the method call's default argument. The `nil`
default here is passed to the original method (`old_render`), preventing
the default from being applied. This meant that any template going
through this monkey patch on Rails 6 blew up when it tried to call
methods on the buffer.
mathieujobin pushed a commit to payrollhero/haml_coffee_assets that referenced this pull request Apr 29, 2021
As of rails/rails#34952, the fallback for nil
buffer was moved up to the method call's default argument. The `nil`
default here is passed to the original method (`old_render`), preventing
the default from being applied. This meant that any template going
through this monkey patch on Rails 6 blew up when it tried to call
methods on the buffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants